You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(97) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(127) |
Feb
(34) |
Mar
(16) |
Apr
(26) |
May
(55) |
Jun
(107) |
Jul
(36) |
Aug
(72) |
Sep
(90) |
Oct
(41) |
Nov
(27) |
Dec
(13) |
2008 |
Jan
(37) |
Feb
(39) |
Mar
(98) |
Apr
(115) |
May
(134) |
Jun
(120) |
Jul
(86) |
Aug
(149) |
Sep
(68) |
Oct
(66) |
Nov
(104) |
Dec
(49) |
2009 |
Jan
(131) |
Feb
(132) |
Mar
(125) |
Apr
(172) |
May
(161) |
Jun
(43) |
Jul
(47) |
Aug
(38) |
Sep
(18) |
Oct
(6) |
Nov
(1) |
Dec
(15) |
2010 |
Jan
(21) |
Feb
(8) |
Mar
(10) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(4) |
2011 |
Jan
(23) |
Feb
(10) |
Mar
(13) |
Apr
(3) |
May
|
Jun
(19) |
Jul
(11) |
Aug
(22) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(12) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(30) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
2013 |
Jan
(3) |
Feb
(40) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: <ans...@us...> - 2006-12-20 03:33:59
|
Revision: 2944 http://jnode.svn.sourceforge.net/jnode/?rev=2944&view=rev Author: ansari82 Date: 2006-12-19 19:33:57 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Fixed bugs in jikesopt magic generation, and force l1a to not inline for better debugging of jikes bugs Modified Paths: -------------- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java 2006-12-19 23:48:37 UTC (rev 2943) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java 2006-12-20 03:33:57 UTC (rev 2944) @@ -622,15 +622,16 @@ bc2ir.appendInstruction(JnodeMagic.create(JNODE_SHARED_STATICS, result)); else bc2ir.appendInstruction(JnodeMagic.create(JNODE_ISOLATED_STATICS, result)); - bc2ir.appendInstruction(Load.create(getOperator(returnType, LOAD_OP), - result.copyRO(), result.copy(), idx.copy(), null, null)); + bc2ir.appendInstruction(Binary.create(INT_ADD, result.copyRO(), result.copy(), idx.copy())); + //bc2ir.appendInstruction(Move.create(INT_MOVE, result.copyRO(), result.copy())); + //, idx.copy(), null, null)); bc2ir.push(result.copyD2U(), returnType); } break; case ISRUNNINGJNODE: { OPT_IntConstantOperand val = new OPT_IntConstantOperand(1); OPT_RegisterOperand result = gc.temps.makeTemp(returnType); - bc2ir.appendInstruction(Load.create(INT_LOAD, result, result.copy(), val, null)); + bc2ir.appendInstruction(Move.create(INT_MOVE, result, val)); bc2ir.push(result.copyD2U(), returnType); } break; Modified: branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java =================================================================== --- branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java 2006-12-19 23:48:37 UTC (rev 2943) +++ branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java 2006-12-20 03:33:57 UTC (rev 2944) @@ -80,7 +80,7 @@ public final class X86Level1ACompiler extends AbstractX86Compiler { /** Should this compiler try to inline methods? */ - private final boolean inlineMethods = true; + private final boolean inlineMethods = false; private final VmIsolateLocal<MagicHelper> magicHelperHolder = new VmIsolateLocal<MagicHelper>(); /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2006-12-19 23:48:38
|
Revision: 2943 http://jnode.svn.sourceforge.net/jnode/?rev=2943&view=rev Author: ansari82 Date: 2006-12-19 15:48:37 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Eliminated compile warnings about MagicPermission, and added debug for jikes-compiled methods Modified Paths: -------------- branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Magic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ComplexLIR2MIRExpansion.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Simplifier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_StackManager.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptExceptionDeliverer.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptGCMapIterator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_AddressConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateMagic.java branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmType.java branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java branches/jikesRVM/core/src/vmmagic/org/vmmagic/unboxed/WordArray.java Modified: branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -72,6 +72,7 @@ import org.jnode.vm.classmgr.VmCompiledCode; import org.jnode.vm.classmgr.VmField; import org.jnode.vm.classmgr.VmIsolatedStatics; +import org.jnode.vm.classmgr.VmMethod; import org.jnode.vm.classmgr.VmMethodCode; import org.jnode.vm.classmgr.VmNormalClass; import org.jnode.vm.classmgr.VmSharedStatics; @@ -82,8 +83,11 @@ import org.jnode.vm.memmgr.HeapHelper; import org.jnode.vm.memmgr.VmHeapManager; import org.jnode.vm.scheduler.VmProcessor; +import org.jnode.vm.x86.compiler.l1a.X86Level1ACompiler; import org.vmmagic.unboxed.UnboxedObject; +import com.ibm.JikesRVM.JikesRVMOptCompiler; + /** * Build the boot image from an assembler compiled bootstrap (in ELF format) * combined with the precompiled Java classes. @@ -195,6 +199,13 @@ final int optLevel = compilers.length - 1; // Use the most optimizing compiler here final NativeCodeCompiler compiler = compilers[optLevel]; + NativeCodeCompiler backup, test = null; + for(int i = 0; i < compilers.length; i++) { + if(compilers[i] instanceof X86Level1ACompiler) { + test = compilers[i]; break; + } + } + if(test==null)backup=null; else backup=test; int oldCount; int newCount; @@ -212,12 +223,24 @@ vmClass.resolveCpRefs(/*clsMgr*/); again = true; } - final int mcnt; + int mcnt; final int startLength = os.getLength(); - if (compHigh) { + if (compHigh && !vmClass.isCompiled()) { log("Full Compile " + vmClass.getName(), Project.MSG_VERBOSE); - mcnt = vmClass.compileBootstrap(compiler, os, optLevel); + final int cnt = vmClass.getNoDeclaredMethods(); + mcnt = 0; + for (int i = 0; i < cnt; i++) { + final VmMethod method = vmClass.getDeclaredMethod(i); + mcnt++; + if(compiler instanceof JikesRVMOptCompiler && !JikesRVMOptCompiler.compilableMethod(method)) { + backup.compileBootstrap(method, os, optLevel); + } + else { + compiler.compileBootstrap(method, os, optLevel); + } + } + vmClass.setCompiled(); totalHighMethods += mcnt; totalHighMethodSize += (os.getLength() - startLength); } else { Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -9,11 +9,13 @@ import org.jnode.vm.Vm; import org.jnode.vm.VmAddress; import org.jnode.vm.VmMagic; +import org.jnode.vm.annotation.MagicPermission; import org.jnode.vm.classmgr.VmAddressMap; import org.jnode.vm.classmgr.VmByteCode; import org.jnode.vm.classmgr.VmCompiledExceptionHandler; import org.jnode.vm.classmgr.VmConstClass; import org.jnode.vm.classmgr.VmMethod; +import org.jnode.vm.classmgr.VmType; import org.jnode.vm.compiler.CompileError; import org.jnode.vm.compiler.CompiledExceptionHandler; import org.jnode.vm.compiler.CompiledMethod; @@ -42,6 +44,7 @@ * @author Mohammad Ansari (ans...@us...) */ +@MagicPermission public class JikesRVMOptCompiler extends AbstractX86Compiler { // is the opt compiler usable? @@ -115,14 +118,40 @@ } public static boolean compilableMethod(VmMethod vmMethod) { - if (vmMethod.getDeclaringClass().getName().contains("org.jnode.test") -// || vmMethod.getDeclaringClass().getName().contains("org.jnode.vm.classmgr") - ) { + if (vmMethod.getDeclaringClass().getName().contains("org.jnode.vm.classmgr.VmType") + && ( + vmMethod.getName().contains("compare") + || vmMethod.getName().contains("equals") + || vmMethod.getName().contains("BootClass") + || vmMethod.getName().contains("i") + || vmMethod.getName().contains("linkAndInitialize") + || vmMethod.getName().contains("link") + || vmMethod.getName().startsWith("do") + || vmMethod.getName().startsWith("is") + || vmMethod.getName().startsWith("getA") + || vmMethod.getName().startsWith("getObjectClass") + || vmMethod.getName().startsWith("getP") + ) + ) + { return true; } else return false; } + public static boolean compilableClass(VmType vmClass) { + if (vmClass.getName().contains("org.jnode.vm.classmgr.Abstract") +// || vmClass.getName().contains("org.jnode.vm.classmgr.ClassDecoder") + || vmClass.getName().contains("org.jnode.vm.classmgr.CompiledCodeList") +// || vmClass.getName().contains("org.jnode.vm.classmgr.IMTBuilder") + || vmClass.getName().contains("org.jnode.vm.classmgr.MethodPragmaFlags") + + ) { + return true; + } + else return false; + } + @Override public NativeStream createNativeStream(ObjectResolver resolver) { X86CpuID cpuid = (X86CpuID) VmProcessor.current().getCPUID(); @@ -174,6 +203,7 @@ public void compileBootstrap(VmMethod method, NativeStream os, int level) { + System.out.println(method.getFullName()); int start = os.getLength(); final CompiledMethod cm; final boolean abstractM = method.isAbstract(); Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Magic.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Magic.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Magic.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -1,6 +1,7 @@ package com.ibm.JikesRVM; import org.jnode.vm.VmMagic; +import org.jnode.vm.annotation.MagicPermission; import org.jnode.vm.compiler.EntryPoints; import org.jnode.vm.x86.compiler.X86JumpTable; import org.vmmagic.unboxed.Address; @@ -12,6 +13,7 @@ import com.ibm.JikesRVM.classloader.VM_Type; import com.ibm.JikesRVM.classloader.VM_Class; +@MagicPermission public class VM_Magic { private static EntryPoints context = null; @@ -81,8 +83,8 @@ } - public static Address getIsolatedTocPointer() { - return Address.fromInt(context.getVmProcessorIsolatedStaticsTable() + public static Offset getIsolatedTocPointer() { + return Offset.fromIntZeroExtend(context.getVmProcessorIsolatedStaticsTable() .getOffset()); } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ComplexLIR2MIRExpansion.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ComplexLIR2MIRExpansion.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ComplexLIR2MIRExpansion.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -4,10 +4,11 @@ //$Id: OPT_ComplexLIR2MIRExpansion.java,v 1.14 2006/01/06 11:10:17 irogers Exp $ package com.ibm.JikesRVM.opt; +import org.jnode.vm.annotation.MagicPermission; + import com.ibm.JikesRVM.*; import com.ibm.JikesRVM.opt.ir.*; import com.ibm.JikesRVM.classloader.*; -import org.vmmagic.unboxed.Offset; /** * Handles the conversion from LIR to MIR of operators whose @@ -17,6 +18,8 @@ * @modified Peter Sweeney * @modified Ian Rogers */ + +@MagicPermission abstract class OPT_ComplexLIR2MIRExpansion extends OPT_IRTools { /** @@ -39,7 +42,7 @@ break; case JNODE_ISOLATED_STATICS_opcode: OPT_MemoryOperand jtocHome = - OPT_MemoryOperand.BD(null,Offset.fromIntSignExtend(VM_Magic.getIsolatedTocPointer().toInt()), + OPT_MemoryOperand.BD(null,VM_Magic.getIsolatedTocPointer(), (byte)OPT_GenericStackManager.WORDSIZE, null, null); jtocHome.setFsSegmentOverride(true); MIR_Move.mutate(s, IA32_MOV, JnodeMagic.getResult(s), jtocHome); Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Simplifier.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Simplifier.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Simplifier.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -7,6 +7,8 @@ import com.ibm.JikesRVM.*; import com.ibm.JikesRVM.classloader.*; import com.ibm.JikesRVM.opt.ir.*; + +import org.jnode.vm.annotation.MagicPermission; import org.vmmagic.unboxed.*; /** * A constant folder, strength reducer and axiomatic simplifier. @@ -25,6 +27,8 @@ * * @author Dave Grove */ + +@MagicPermission public abstract class OPT_Simplifier extends OPT_IRTools implements OPT_Operators { // NOTE: The convention is that constant folding is controlled based // on the type of the result of the operator, not the type of its inputs. Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_StackManager.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_StackManager.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_StackManager.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -11,6 +11,8 @@ import java.util.Iterator; import java.util.HashSet; import java.util.HashMap; + +import org.jnode.vm.annotation.MagicPermission; import org.vmmagic.unboxed.Offset; /** @@ -24,6 +26,8 @@ * @author Mauricio J. Serrano * @author Julian Dolby */ + +@MagicPermission public final class OPT_StackManager extends OPT_GenericStackManager implements OPT_Operators { Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptExceptionDeliverer.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptExceptionDeliverer.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptExceptionDeliverer.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -26,79 +26,8 @@ Address catchBlockInstructionAddress, Throwable exceptionObject, VM_Registers registers) { - VM_OptCompiledMethod optMethod = (VM_OptCompiledMethod)compiledMethod; - Address fp = registers.getInnermostFramePointer(); - VM_Thread myThread = VM_Thread.getCurrentThread(); - - if (TRACE) { - VM.sysWrite("Frame size of "); - VM.sysWrite(optMethod.getMethod()); - VM.sysWrite(" is "); - VM.sysWrite(optMethod.getFrameFixedSize()); - VM.sysWrite("\n"); - } - - // reset sp to "empty params" state (ie same as it was after prologue) - Address sp = fp.sub(optMethod.getFrameFixedSize()); - registers.gprs.set(STACK_POINTER, sp); - - // store exception object for later retrieval by catch block - int offset = optMethod.getUnsignedExceptionOffset(); - if (offset != 0) { - // only put the exception object in the stackframe if the catch block is expecting it. - // (if the method hasn't allocated a stack slot for caught exceptions, then we can safely - // drop the exceptionObject on the floor). - VM_Magic.setObjectAtOffset(VM_Magic.addressAsObject(fp), Offset.fromIntSignExtend(-offset), exceptionObject); - if (TRACE) { - VM.sysWrite("Storing exception object "); - VM.sysWrite(VM_Magic.objectAsAddress(exceptionObject)); - VM.sysWrite(" at offset "); - VM.sysWrite(offset); - VM.sysWrite(" from framepoint "); - VM.sysWrite(fp); - VM.sysWrite("\n"); - } - } - - if (TRACE) { - VM.sysWrite("Registers before delivering exception in "); - VM.sysWrite(optMethod.getMethod()); - VM.sysWrite("\n"); - for (int i=0; i<NUM_GPRS; i++) { - VM.sysWrite(GPR_NAMES[i]); - VM.sysWrite(" = "); - VM.sysWrite(registers.gprs.get(i)); - VM.sysWrite("\n"); - } - } - - // set address at which to resume executing frame - registers.ip = catchBlockInstructionAddress; - - if (TRACE) { - VM.sysWrite("Set ip to "); - VM.sysWrite(registers.ip); - VM.sysWrite("\n"); - } - - VM.enableGC(); // disabled right before VM_Runtime.deliverException was called - - if (VM.VerifyAssertions) VM._assert(registers.inuse == true); - registers.inuse = false; - - // 'give back' the portion of the stack we borrowed to run - // exception delivery code when invoked for a hardware trap. - // If this was a straight software trap (athrow) then setting - // the stacklimit should be harmless, since the stacklimit should already have exactly - // the value we are setting it too. - if (!myThread.hardwareExceptionRegisters.inuse) { - myThread.stackLimit = VM_Magic.objectAsAddress(myThread.stack).add(STACK_SIZE_GUARD); - VM_Processor.getCurrentProcessor().activeThreadStackLimit = myThread.stackLimit; - } - - // "branches" to catchBlockInstructionAddress - VM_Magic.restoreHardwareExceptionState(registers); - if (VM.VerifyAssertions) VM._assert(NOT_REACHED); + try{ throw new Exception("VM_OptExceptionDeliverer.deliverException() not implemented!"); } + catch (Exception e) { e.printStackTrace();} } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptGCMapIterator.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptGCMapIterator.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptGCMapIterator.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -34,78 +34,8 @@ * save the volatile gprs. */ void updateLocateRegisters() { - - // HIGH MEMORY - // - // +---------------+ | - // FP-> | saved FP | <-- this frame's caller's frame | - // +---------------+ | - // | cmid | <-- this frame's compiledmethod id | - // +---------------+ | - // | | | - // | Spill Area | <-- spills and other method-specific | - // | ... | compiler-managed storage | - // +---------------+ | - // | Saved FP | only SaveVolatile Frames | - // | State | | - // +---------------+ | - // | VolGPR[0] | - // | ... | only SaveVolatile Frames - // | VolGPR[n] | - // +---------------+ - // | NVolGPR[k] | <-- cm.getUnsignedNonVolatileOffset() - // | ... | k == cm.getFirstNonVolatileGPR() - // | NVolGPR[n] | - // +---------------+ - // - // LOW MEMORY - - int frameOffset = compiledMethod.getUnsignedNonVolatileOffset(); - if (frameOffset >= 0) { - // get to the non vol area - Address nonVolArea = framePtr.sub(frameOffset); - - // update non-volatiles - int first = compiledMethod.getFirstNonVolatileGPR(); - if (first >= 0) { - // move to the beginning of the nonVol area - Address location = nonVolArea; - - for (int i = first; i < NUM_NONVOLATILE_GPRS; i++) { - // determine what register index corresponds to this location - int registerIndex = NONVOLATILE_GPRS[i]; - registerLocations.set(registerIndex, location); - if (DEBUG) { - VM.sysWrite("UpdateRegisterLocations: Register "); - VM.sysWrite(registerIndex); - VM.sysWrite(" to Location "); - VM.sysWrite(location); - VM.sysWrite("\n"); - } - location = location.sub(BYTES_IN_ADDRESS); - } - } - - // update volatiles if needed - if (compiledMethod.isSaveVolatile()) { - // move to the beginning of the nonVol area - Address location = nonVolArea.add(4 * NUM_VOLATILE_GPRS); - - for (int i = 0; i < NUM_VOLATILE_GPRS; i++) { - // determine what register index corresponds to this location - int registerIndex = VOLATILE_GPRS[i]; - registerLocations.set(registerIndex, location); - if (DEBUG) { - VM.sysWrite("UpdateRegisterLocations: Register "); - VM.sysWrite(registerIndex); - VM.sysWrite(" to Location "); - VM.sysWrite(location); - VM.sysWrite("\n"); - } - location = location.sub(BYTES_IN_ADDRESS); - } - } - } + try{ throw new Exception("VM_OptGCMapIterator() not implemented!"); } + catch (Exception e) { e.printStackTrace();} } /** Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_AddressConstantOperand.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_AddressConstantOperand.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_AddressConstantOperand.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -5,6 +5,8 @@ package com.ibm.JikesRVM.opt.ir; import com.ibm.JikesRVM.opt.OPT_Bits; + +import org.jnode.vm.annotation.MagicPermission; import org.vmmagic.unboxed.*; import com.ibm.JikesRVM.VM_SizeConstants; import com.ibm.JikesRVM.VM; @@ -16,6 +18,8 @@ * @see OPT_Operand * @author John Whaley */ + +@MagicPermission public final class OPT_AddressConstantOperand extends OPT_ConstantOperand { /** Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -722,15 +722,4 @@ } return true; } - - private static void cmpHelper(OPT_BC2IR bc2ir, - OPT_GenerationContext gc, - OPT_ConditionOperand cond, - OPT_Operand given_o2) { - OPT_Operand o2 = given_o2 == null ? bc2ir.pop() : given_o2; - OPT_Operand o1 = bc2ir.pop(); - OPT_RegisterOperand res = gc.temps.makeTempInt(); - bc2ir.appendInstruction(BooleanCmp.create(BOOLEAN_CMP_ADDR, res.copyRO(), o1, o2, cond, new OPT_BranchProfileOperand())); - bc2ir.push(res.copyD2U()); - } } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateMagic.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateMagic.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateMagic.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -822,7 +822,7 @@ return true; } - private static void cmpHelper(OPT_BC2IR bc2ir, + protected static void cmpHelper(OPT_BC2IR bc2ir, OPT_GenerationContext gc, OPT_ConditionOperand cond, OPT_Operand given_o2) { Modified: branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmType.java =================================================================== --- branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmType.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmType.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -1915,6 +1915,10 @@ } return rc; } + + public void setCompiled() { + state |= VmTypeState.ST_COMPILED; + } /** * Compile all the methods in this class during runtime. @@ -2145,7 +2149,7 @@ final Throwable targetEx = ex.getTargetException(); if (targetEx != null) { ex.getTargetException().printStackTrace(); - // Unsafe.die("VmType.doInitialize"); + Unsafe.die("VmType.doInitialize: "+getName()); throw new ExceptionInInitializerError(ex .getTargetException()); } else { Modified: branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java =================================================================== --- branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -150,8 +150,8 @@ } this.compilers[2] = new JikesRVMOptCompiler(); - //this.compilers[3] = this.compilers[2]; - this.compilers[3] = this.compilers[1]; + this.compilers[3] = this.compilers[2]; +// this.compilers[3] = this.compilers[1]; this.testCompilers = null; } Modified: branches/jikesRVM/core/src/vmmagic/org/vmmagic/unboxed/WordArray.java =================================================================== --- branches/jikesRVM/core/src/vmmagic/org/vmmagic/unboxed/WordArray.java 2006-12-19 21:14:50 UTC (rev 2942) +++ branches/jikesRVM/core/src/vmmagic/org/vmmagic/unboxed/WordArray.java 2006-12-19 23:48:37 UTC (rev 2943) @@ -49,6 +49,6 @@ * *****************************************************************/ - public void set(byte stack_pointer, Address sp) {/*TODO*/} - public void set(int registerIndex, Address location) {/*TODO*/} +// public void set(byte stack_pointer, Address sp) {/*TODO*/} +// public void set(int registerIndex, Address location) {/*TODO*/} } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2006-12-19 21:14:54
|
Revision: 2942 http://jnode.svn.sourceforge.net/jnode/?rev=2942&view=rev Author: lsantha Date: 2006-12-19 13:14:50 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Forking javac to make the overall build process less resource intensive. Modified Paths: -------------- trunk/all/lib/jnode.xml Modified: trunk/all/lib/jnode.xml =================================================================== --- trunk/all/lib/jnode.xml 2006-12-19 21:13:36 UTC (rev 2941) +++ trunk/all/lib/jnode.xml 2006-12-19 21:14:50 UTC (rev 2942) @@ -7,6 +7,8 @@ <javac destdir="${my-classes.dir}" debug="on" optimize="on" + fork="on" + memoryMaximumSize="512m" compiler="modern" includeJavaRuntime="false" target="${java.target}" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2006-12-19 21:13:45
|
Revision: 2941 http://jnode.svn.sourceforge.net/jnode/?rev=2941&view=rev Author: lsantha Date: 2006-12-19 13:13:36 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Removed directory classpath/5.0 of Java 5 speciffic sources. Modified Paths: -------------- trunk/all/build.xml Modified: trunk/all/build.xml =================================================================== --- trunk/all/build.xml 2006-12-19 21:09:18 UTC (rev 2940) +++ trunk/all/build.xml 2006-12-19 21:13:36 UTC (rev 2941) @@ -366,7 +366,6 @@ <pathelement location="${root.dir}/core/src/classpath/java"/> <pathelement location="${root.dir}/core/src/classpath/javax"/> <pathelement location="${root.dir}/core/src/classpath/org"/> - <pathelement location="${root.dir}/core/src/classpath/5.0"/> <pathelement location="${root.dir}/core/src/classpath/ext"/> <pathelement location="${root.dir}/core/src/classpath/vm"/> <pathelement location="${root.dir}/core/src/core"/> @@ -402,7 +401,6 @@ <pathelement location="${root.dir}/core/src/classpath/java"/> <pathelement location="${root.dir}/core/src/classpath/javax"/> <pathelement location="${root.dir}/core/src/classpath/org"/> - <pathelement location="${root.dir}/core/src/classpath/5.0"/> <pathelement location="${root.dir}/core/src/classpath/ext"/> <pathelement location="${root.dir}/core/src/classpath/vm"/> <pathelement location="${root.dir}/core/src/core"/> @@ -485,9 +483,6 @@ <fileset dir="${root.dir}/core/src/classpath/tools"> <patternset refid="cp-includes-pattern"/> </fileset> - <fileset dir="${root.dir}/core/src/classpath/5.0" target="1.5"> - <patternset refid="cp-includes-pattern"/> - </fileset> </vmsources> <vmspecificsources> <fileset dir="${root.dir}/core/src/classpath/vm"> @@ -499,14 +494,10 @@ <patternset refid="cp-includes-pattern"/> <patternset refid="cp-sources-pattern"/> </fileset> - <fileset dir="${root.dir}/../classpath-5.0" target="1.5" ignoremissing="on"> + <fileset dir="${root.dir}/../classpath/external/jsr166"> <patternset refid="cp-includes-pattern"/> <patternset refid="cp-sources-pattern"/> </fileset> - <fileset dir="${root.dir}/../classpath-5.0/external/jsr166" target="1.5" ignoremissing="on"> - <patternset refid="cp-includes-pattern"/> - <patternset refid="cp-sources-pattern"/> - </fileset> <fileset dir="${root.dir}/../classpath/resource"> <patternset refid="cp-includes-pattern"/> </fileset> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2006-12-19 21:09:21
|
Revision: 2940 http://jnode.svn.sourceforge.net/jnode/?rev=2940&view=rev Author: lsantha Date: 2006-12-19 13:09:18 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Removed directory classpath/5.0 of Java 5 speciffic sources. Removed Paths: ------------- trunk/core/src/classpath/5.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2006-12-19 12:07:12
|
Revision: 2939 http://jnode.svn.sourceforge.net/jnode/?rev=2939&view=rev Author: ansari82 Date: 2006-12-19 04:07:10 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Removed Jikes-related modifications that were applied to try and solve build problems, but didn't succeed in solving build problems Modified Paths: -------------- branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java Modified: branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2006-12-19 12:06:43 UTC (rev 2938) +++ branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2006-12-19 12:07:10 UTC (rev 2939) @@ -279,7 +279,6 @@ loadClass(VmType.class); loadClass(VmSystem.class); loadClass(VmSystemObject.class); - loadClass(VM.class); final X86BinaryAssembler.ObjectInfo initCodeObject = os .startObject(vmCodeClass); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2006-12-19 12:06:45
|
Revision: 2938 http://jnode.svn.sourceforge.net/jnode/?rev=2938&view=rev Author: ansari82 Date: 2006-12-19 04:06:43 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Removed Jikes-related modifications that were applied to try and solve build problems, but didn't succeed in solving build problems Modified Paths: -------------- branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java Modified: branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2006-12-19 11:42:30 UTC (rev 2937) +++ branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2006-12-19 12:06:43 UTC (rev 2938) @@ -73,14 +73,6 @@ import org.jnode.vm.x86.compiler.X86CompilerConstants; import org.jnode.vm.x86.compiler.X86JumpTable; -import com.ibm.JikesRVM.VM; -import com.ibm.JikesRVM.VM_Processor; -import com.ibm.JikesRVM.VM_Thread; -import com.ibm.JikesRVM.classloader.VM_BootstrapClassLoader; -import com.ibm.JikesRVM.classloader.VM_Method; -import com.ibm.JikesRVM.classloader.VM_Type; -import com.ibm.JikesRVM.classloader.VM_TypeReference; - /** * @author epr */ @@ -288,12 +280,6 @@ loadClass(VmSystem.class); loadClass(VmSystemObject.class); loadClass(VM.class); - loadClass(VM_Method.class); - loadClass(VM_Processor.class); - loadClass(VM_BootstrapClassLoader.class); - loadClass(VM_Thread.class); - loadClass(VM_Type.class); - loadClass(VM_TypeReference.class); final X86BinaryAssembler.ObjectInfo initCodeObject = os .startObject(vmCodeClass); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kon...@us...> - 2006-12-19 11:42:32
|
Revision: 2937 http://jnode.svn.sourceforge.net/jnode/?rev=2937&view=rev Author: konkubinaten Date: 2006-12-19 03:42:30 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Fix the build system. I do not really know why it works now and didn't before, but at least it does :) Modified Paths: -------------- branches/jikesRVM/build.sh branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java Modified: branches/jikesRVM/build.sh =================================================================== --- branches/jikesRVM/build.sh 2006-12-17 10:27:39 UTC (rev 2936) +++ branches/jikesRVM/build.sh 2006-12-19 11:42:30 UTC (rev 2937) @@ -2,7 +2,6 @@ dir=`dirname $0` -for i in `find $dir/core/src/core/ |grep -v .svn | sort -r`; do touch $i ; done java -Xmx1450M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* Modified: branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2006-12-17 10:27:39 UTC (rev 2936) +++ branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2006-12-19 11:42:30 UTC (rev 2937) @@ -565,14 +565,29 @@ // Twice, this is intended! emitObjects(os, arch, blockedObjects, false); - // Emit the statics table + /* Emit the statics table log("Emit statics", Project.MSG_VERBOSE); blockedObjects.remove(clsMgr.getSharedStatics()); blockedObjects.remove(clsMgr.getIsolatedStatics()); emitObjects(os, arch, blockedObjects, true); // Twice, this is intended! emitObjects(os, arch, blockedObjects, true); + */ + log("Emit shared statics", Project.MSG_VERBOSE); + blockedObjects.remove(clsMgr.getSharedStatics()); + emitObjects(os, arch, blockedObjects, true); + // Twice, this is intended! + emitObjects(os, arch, blockedObjects, true); + + log("Emit isolated statics", Project.MSG_VERBOSE); + blockedObjects.remove(clsMgr.getIsolatedStatics()); + emitObjects(os, arch, blockedObjects, true); + // Twice, this is intended! + emitObjects(os, arch, blockedObjects, true); + + + // Emit the remaining objects log("Emit rest; blocked=" + blockedObjects, Project.MSG_VERBOSE); emitObjects(os, arch, null, true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2006-12-17 10:27:42
|
Revision: 2936 http://jnode.svn.sourceforge.net/jnode/?rev=2936&view=rev Author: lsantha Date: 2006-12-17 02:27:39 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Test. Modified Paths: -------------- trunk/gui/src/test/org/jnode/test/gui/BoxWorld.java Modified: trunk/gui/src/test/org/jnode/test/gui/BoxWorld.java =================================================================== --- trunk/gui/src/test/org/jnode/test/gui/BoxWorld.java 2006-12-16 21:08:45 UTC (rev 2935) +++ trunk/gui/src/test/org/jnode/test/gui/BoxWorld.java 2006-12-17 10:27:39 UTC (rev 2936) @@ -159,20 +159,9 @@ -895342486, -759943957, -625595029, -624578228, -2147043955, 36, -865693532, -697164346, -796745305, -2147077782, 35, -758894356, -757844755, -790382259, - -2147141330, 798 }, - // 40 + -2147141330, 798 } + }; - // ISABELLA :X - { 137, -833416027, -732654331, -631892635, -531130939, -530278234, - -529228633, -763191160, -929554104, -661281463, -928471543, - -893867862, -859655637, -758894356, -523783732, -724257236, - -623495827, 1073742285, 138, -798779194, -664430266, - -563668570, -797729593, -663380665, -562618969, -695983928, - -595156600, -795630104, -594107095, -794613271, -693819094, - -593057398, -860345878, -759943957, -659182261, -524833365, - 20, -828168984, 1073742283, 19, -658132660, 1073742252, - 1358 }, }; - // ************** DIMENSIONS ******************** private static final int CELL_SIZE = 20; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kon...@us...> - 2006-12-16 21:08:46
|
Revision: 2935 http://jnode.svn.sourceforge.net/jnode/?rev=2935&view=rev Author: konkubinaten Date: 2006-12-16 13:08:45 -0800 (Sat, 16 Dec 2006) Log Message: ----------- This improves the stability of the build process. It seems the boot image creation depends on the ordering the files are comming from the native OS. Modified Paths: -------------- branches/jikesRVM/build.sh Modified: branches/jikesRVM/build.sh =================================================================== --- branches/jikesRVM/build.sh 2006-12-16 15:26:32 UTC (rev 2934) +++ branches/jikesRVM/build.sh 2006-12-16 21:08:45 UTC (rev 2935) @@ -1,6 +1,8 @@ #!/bin/sh dir=`dirname $0` -java -Xmx1024M -Xms512M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* +for i in `find $dir/core/src/core/ |grep -v .svn | sort -r`; do touch $i ; done +java -Xmx1450M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2006-12-16 15:26:34
|
Revision: 2934 http://jnode.svn.sourceforge.net/jnode/?rev=2934&view=rev Author: ansari82 Date: 2006-12-16 07:26:32 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Changes to make build more stable by removing opt, opt.ir from compiler packages in JikesRVMOptCompiler.java, adding a default compiler command, and cleaning up X86stackframe to have cleaner declarations, and fix spelling mistake in x86stubcompiler Modified Paths: -------------- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/stub/X86StubCompiler.java branches/jikesRVM/dbuild.sh branches/jikesRVM/shell/descriptors/org.jnode.shell.command.xml Added Paths: ----------- branches/jikesRVM/shell/src/shell/org/jnode/shell/command/DefaultCompilerCommand.java Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2006-12-16 15:06:27 UTC (rev 2933) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2006-12-16 15:26:32 UTC (rev 2934) @@ -50,7 +50,6 @@ public static OPT_Options options; public static OPT_OptimizationPlanElement[] optimizationPlan; - private boolean init = false; public JikesRVMOptCompiler() { options = new OPT_Options(); @@ -157,15 +156,17 @@ @Override public String[] getCompilerPackages() { - return new String[] { "org.jnode.vm.x86.compiler", - "com.ibm.JikesRVM", - "com.ibm.JikesRVM.adaptive", - "com.ibm.JikesRVM.classloader", - "com.ibm.JikesRVM.memoryManagers.mmInterface", - "com.ibm.JikesRVM.opt", - "com.ibm.JikesRVM.opt.ir", - "com.ibm.JikesRVM.OSR", - "com.ibm.JikesRVM.util"}; + return new String[] { + "org.jnode.vm.x86.compiler", + "com.ibm.JikesRVM", + "com.ibm.JikesRVM.adaptive", + "com.ibm.JikesRVM.classloader", + "com.ibm.JikesRVM.memoryManagers.mmInterface", + //"com.ibm.JikesRVM.opt", + //"com.ibm.JikesRVM.opt.ir", + "com.ibm.JikesRVM.OSR", + "com.ibm.JikesRVM.util", + }; } Modified: branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java =================================================================== --- branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java 2006-12-16 15:06:27 UTC (rev 2933) +++ branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java 2006-12-16 15:26:32 UTC (rev 2934) @@ -182,13 +182,13 @@ final NativeCodeCompiler cmps[]; - int index; - if (optLevel == 0) - index = 0; - else if (defaultCompiler == 0) - index = optLevel; - else - index = defaultCompiler; + int index; + if (optLevel == 0) + index = 0; + else if (defaultCompiler == 0) + index = optLevel; + else + index = defaultCompiler; if (enableTestCompilers) { optLevel += compilers.length; Modified: branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java =================================================================== --- branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java 2006-12-16 15:06:27 UTC (rev 2933) +++ branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java 2006-12-16 15:26:32 UTC (rev 2934) @@ -140,6 +140,8 @@ public VmX86Architecture(int referenceSize, String compiler) { super(referenceSize, new VmX86StackReader(referenceSize)); this.compilers = new NativeCodeCompiler[4]; + + // Production system compiler list this.compilers[0] = new X86StubCompiler(); if ("L1B".equals(compiler)) { this.compilers[1] = new X86Level1BCompiler(); @@ -147,8 +149,10 @@ this.compilers[1] = new X86Level1ACompiler(); } this.compilers[2] = new JikesRVMOptCompiler(); - //this.compilers[3] = this.compilers[2]; - this.compilers[3] = this.compilers[1]; + + //this.compilers[3] = this.compilers[2]; + this.compilers[3] = this.compilers[1]; + this.testCompilers = null; } Modified: branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java =================================================================== --- branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java 2006-12-16 15:06:27 UTC (rev 2933) +++ branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java 2006-12-16 15:26:32 UTC (rev 2934) @@ -28,6 +28,7 @@ import org.jnode.assembler.x86.X86Constants; import org.jnode.assembler.x86.X86Register; import org.jnode.assembler.x86.X86Register.GPR; +import org.jnode.vm.Vm; import org.jnode.vm.classmgr.TypeSizeInfo; import org.jnode.vm.classmgr.VmByteCode; import org.jnode.vm.classmgr.VmInterpretedExceptionHandler; @@ -80,7 +81,7 @@ * Number of byte on the stack occupied by saved registers. See * {@link #saveRegisters()} */ - private static final int SAVED_REGISTERSPACE = 2 * 4; + private static final int SAVED_REGISTERSPACE = 2 * Vm.getArch().getReferenceSize(); /** * Create a new instance @@ -368,9 +369,9 @@ * @see org.jnode.vm.x86.VmX86StackReader */ private final void saveRegisters() { - os.writePUSH(X86Register.EBX); - //os.writePUSH(Register.EDI); - os.writePUSH(X86Register.ESI); + os.writePUSH(os.isCode32() ? (GPR)X86Register.EBX : X86Register.RBX); + //os.writePUSH(os.isCode32() ? (GPR)X86Register.EDI : X86Register.RDI); + os.writePUSH(os.isCode32() ? (GPR)X86Register.ESI : X86Register.RSI); } /** @@ -380,8 +381,8 @@ * @see org.jnode.vm.x86.VmX86StackReader */ private final void restoreRegisters() { - os.writePOP(X86Register.ESI); - //os.writePOP(Register.EDI); - os.writePOP(X86Register.EBX); + os.writePOP(os.isCode32() ? (GPR)X86Register.ESI : X86Register.RSI); + //os.writePOP(os.isCode32() ? (GPR)X86Register.EDI : X86Register.RDI); + os.writePOP(os.isCode32() ? (GPR)X86Register.EBX : X86Register.RBX); } } Modified: branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/stub/X86StubCompiler.java =================================================================== --- branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/stub/X86StubCompiler.java 2006-12-16 15:06:27 UTC (rev 2933) +++ branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/stub/X86StubCompiler.java 2006-12-16 15:26:32 UTC (rev 2934) @@ -146,6 +146,6 @@ */ @Override public String[] getCompilerPackages() { - return new String[] { "org.jnode.vm.x86.compiler", "org.jnode.vm.x86.compiler.stup" }; + return new String[] { "org.jnode.vm.x86.compiler", "org.jnode.vm.x86.compiler.stub" }; } } Modified: branches/jikesRVM/dbuild.sh =================================================================== --- branches/jikesRVM/dbuild.sh 2006-12-16 15:06:27 UTC (rev 2933) +++ branches/jikesRVM/dbuild.sh 2006-12-16 15:26:32 UTC (rev 2934) @@ -1,6 +1,6 @@ #!/bin/sh dir=`dirname $0` -java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xmx1576M -Xms128M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* +java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xmx1024M -Xms512M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* Modified: branches/jikesRVM/shell/descriptors/org.jnode.shell.command.xml =================================================================== --- branches/jikesRVM/shell/descriptors/org.jnode.shell.command.xml 2006-12-16 15:06:27 UTC (rev 2933) +++ branches/jikesRVM/shell/descriptors/org.jnode.shell.command.xml 2006-12-16 15:26:32 UTC (rev 2934) @@ -25,6 +25,7 @@ <alias name="class" class="org.jnode.shell.command.ClassCommand"/> <alias name="classpath" class="org.jnode.shell.command.ClasspathCommand" internal="yes"/> <alias name="compile" class="org.jnode.shell.command.CompileCommand"/> + <alias name="defcomp" class="org.jnode.shell.command.DefaultCompilerCommand"/> <alias name="disasm" class="org.jnode.shell.command.DisassembleCommand"/> <alias name="date" class="org.jnode.shell.command.DateCommand"/> <alias name="echo" class="org.jnode.shell.command.EchoCommand"/> Added: branches/jikesRVM/shell/src/shell/org/jnode/shell/command/DefaultCompilerCommand.java =================================================================== --- branches/jikesRVM/shell/src/shell/org/jnode/shell/command/DefaultCompilerCommand.java (rev 0) +++ branches/jikesRVM/shell/src/shell/org/jnode/shell/command/DefaultCompilerCommand.java 2006-12-16 15:26:32 UTC (rev 2934) @@ -0,0 +1,49 @@ +/* + * $Id: CompileCommand.java 2224 2006-01-01 12:49:03Z epr $ + * + * JNode.org + * Copyright (C) 2003-2006 JNode.org + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; If not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.jnode.shell.command; + +import org.jnode.shell.help.Help; +import org.jnode.shell.help.IntegerArgument; +import org.jnode.shell.help.Parameter; +import org.jnode.shell.help.ParsedArguments; +import org.jnode.vm.LoadCompileService; + +/** + * @author Mohammad Ansari (ans...@us...) + */ + +public class DefaultCompilerCommand { + + static final IntegerArgument ARG_LEVEL = new IntegerArgument("number", "the compiler number (usually JikesOpt is 2"); + + public static Help.Info HELP_INFO = new Help.Info("defcomp", "Set default compiler", new Parameter[] { new Parameter(ARG_LEVEL, Parameter.MANDATORY)}); + + public static void main(String[] args) throws Exception { + final ParsedArguments cmdLine = HELP_INFO.parse(args); + + final int level = ARG_LEVEL.getInteger(cmdLine); + + LoadCompileService.setDefaultCompiler(level); + System.out.println("Default compiler id now: " + level); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kon...@us...> - 2006-12-16 15:06:30
|
Revision: 2933 http://jnode.svn.sourceforge.net/jnode/?rev=2933&view=rev Author: konkubinaten Date: 2006-12-16 07:06:27 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Update to support the setting of default compiler Modified Paths: -------------- branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java Modified: branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java =================================================================== --- branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java 2006-12-15 16:55:41 UTC (rev 2932) +++ branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java 2006-12-16 15:06:27 UTC (rev 2933) @@ -39,6 +39,8 @@ private final NativeCodeCompiler[] testCompilers; private static boolean started = false; + + private static int defaultCompiler = 0; /** * Default ctor @@ -177,14 +179,21 @@ */ private void doCompile(VmMethod vmMethod, int optLevel, boolean enableTestCompilers) { + final NativeCodeCompiler cmps[]; - int index; + + int index; + if (optLevel == 0) + index = 0; + else if (defaultCompiler == 0) + index = optLevel; + else + index = defaultCompiler; + if (enableTestCompilers) { - index = optLevel; optLevel += compilers.length; cmps = testCompilers; } else { - index = optLevel; cmps = compilers; } @@ -342,4 +351,8 @@ return "Error in class loading: "; } } + + public static void setDefaultCompiler(int defaultCompiler) { + LoadCompileService.defaultCompiler = defaultCompiler; + } } Modified: branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java =================================================================== --- branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java 2006-12-15 16:55:41 UTC (rev 2932) +++ branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java 2006-12-16 15:06:27 UTC (rev 2933) @@ -147,7 +147,8 @@ this.compilers[1] = new X86Level1ACompiler(); } this.compilers[2] = new JikesRVMOptCompiler(); - this.compilers[3] = new X86Level1ACompiler(); + //this.compilers[3] = this.compilers[2]; + this.compilers[3] = this.compilers[1]; this.testCompilers = null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2006-12-15 16:55:42
|
Revision: 2932 http://jnode.svn.sourceforge.net/jnode/?rev=2932&view=rev Author: ansari82 Date: 2006-12-15 08:55:41 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Added to benchmarks in core/lib (JScience and SciMark 2), which get loaded as part of the tests grub entry. Also amended necessary xml files. Notes ----- Strangle, this has made the build much more stable. Could others check and verify this? Modified Paths: -------------- branches/jikesRVM/all/build.xml branches/jikesRVM/all/conf/tests-plugin-list.xml branches/jikesRVM/build.sh Added Paths: ----------- branches/jikesRVM/core/descriptors/benchmarks.xml branches/jikesRVM/core/lib/jscience.jar branches/jikesRVM/core/lib/scimark2.jar Modified: branches/jikesRVM/all/build.xml =================================================================== --- branches/jikesRVM/all/build.xml 2006-12-15 01:51:58 UTC (rev 2931) +++ branches/jikesRVM/all/build.xml 2006-12-15 16:55:41 UTC (rev 2932) @@ -22,6 +22,8 @@ <property name="jnode-builder.jar" value="${build.dir}/descriptors/jnode-builder.jar"/> <property name="jnode-core.jar" value="${root.dir}/core/build/classes"/> + <property name="jscience.jar" value="${root.dir}/core/lib"/> + <property name="scimark2.jar" value="${root.dir}/core/lib"/> <property name="jnode-distr.jar" value="${root.dir}/distr/build/classes"/> <property name="jnode-fs.jar" value="${root.dir}/fs/build/classes"/> <property name="jnode-gui.jar" value="${root.dir}/gui/build/classes"/> @@ -208,6 +210,8 @@ <libalias name="edtftpj.jar" alias="${edtftpj.jar}"/> <libalias name="jcifs.jar" alias="${jcifs.jar}"/> <libalias name="ejc.jar" alias="${ejc.jar}"/> + <libalias name="jscience.jar" alias="${jscience.jar}"/> + <libalias name="scimark2.jar" alias="${scimark2.jar}"/> <descriptors dir="${descriptors.dir}/"> <include name="*.xml"/> Modified: branches/jikesRVM/all/conf/tests-plugin-list.xml =================================================================== --- branches/jikesRVM/all/conf/tests-plugin-list.xml 2006-12-15 01:51:58 UTC (rev 2931) +++ branches/jikesRVM/all/conf/tests-plugin-list.xml 2006-12-15 16:55:41 UTC (rev 2932) @@ -12,6 +12,7 @@ <plugin id="gnu.mauve.core"/> <plugin id="gnu.mauve.java.util"/> <plugin id="gnu.mauve.java.lang"/> + <plugin id="benchmark"/> <plugin id="org.objectweb.asm"/> <plugin id="net.sf.cglib"/> @@ -28,4 +29,4 @@ <plugin id="jfunc"/> <plugin id="org.jnode.testrunner"/> -</plugin-list> \ No newline at end of file +</plugin-list> Modified: branches/jikesRVM/build.sh =================================================================== --- branches/jikesRVM/build.sh 2006-12-15 01:51:58 UTC (rev 2931) +++ branches/jikesRVM/build.sh 2006-12-15 16:55:41 UTC (rev 2932) @@ -1,6 +1,6 @@ #!/bin/sh dir=`dirname $0` -java -Xmx712M -Xms128M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* +java -Xmx1024M -Xms512M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* Added: branches/jikesRVM/core/descriptors/benchmarks.xml =================================================================== --- branches/jikesRVM/core/descriptors/benchmarks.xml (rev 0) +++ branches/jikesRVM/core/descriptors/benchmarks.xml 2006-12-15 16:55:41 UTC (rev 2932) @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plugin SYSTEM "jnode.dtd"> + +<plugin id="benchmark" + name="Benchmark classes" + version="0.0" + license-name="Different" + provider-name="Different"> + + <extension point="org.jnode.shell.aliases"> + <alias name="BenchJScience" class="org.jscience.JScience"/> + <alias name="BenchScimark" class="jnt.scimark2.commandline"/> + </extension> + + + <runtime> + <library name="jscience.jar"> + <export name="*"/> + </library> + + <library name="scimark2.jar"> + <export name="*"/> + </library> + + <!-- --> + + </runtime> + +</plugin> \ No newline at end of file Added: branches/jikesRVM/core/lib/jscience.jar =================================================================== (Binary files differ) Property changes on: branches/jikesRVM/core/lib/jscience.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: branches/jikesRVM/core/lib/scimark2.jar =================================================================== (Binary files differ) Property changes on: branches/jikesRVM/core/lib/scimark2.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qa...@us...> - 2006-12-15 01:52:01
|
Revision: 2931 http://jnode.svn.sourceforge.net/jnode/?rev=2931&view=rev Author: qades Date: 2006-12-14 17:51:58 -0800 (Thu, 14 Dec 2006) Log Message: ----------- reverted broken changes Modified Paths: -------------- trunk/core/src/classpath/gnu/gnu/java/net/PlainDatagramSocketImpl.java trunk/core/src/classpath/gnu/gnu/java/net/PlainSocketImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/DatagramChannelImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/DatagramChannelSelectionKey.java trunk/core/src/classpath/gnu/gnu/java/nio/FileLockImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/NIOSocket.java trunk/core/src/classpath/gnu/gnu/java/nio/PipeImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/SelectionKeyImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/SelectorImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/SelectorProviderImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/ServerSocketChannelImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/ServerSocketChannelSelectionKey.java trunk/core/src/classpath/gnu/gnu/java/nio/SocketChannelImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/SocketChannelSelectionKey.java trunk/core/src/classpath/gnu/gnu/java/nio/SocketChannelSelectionKeyImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/charset/ByteCharset.java trunk/core/src/classpath/gnu/gnu/java/nio/charset/ISO_8859_1.java trunk/core/src/classpath/gnu/gnu/java/nio/charset/US_ASCII.java trunk/core/src/classpath/gnu/gnu/java/nio/charset/iconv/IconvDecoder.java trunk/core/src/classpath/gnu/gnu/java/nio/charset/iconv/IconvEncoder.java trunk/core/src/classpath/java/java/io/FileDescriptor.java trunk/core/src/classpath/java/java/io/FileInputStream.java trunk/core/src/classpath/java/java/io/FileOutputStream.java trunk/core/src/classpath/java/java/io/RandomAccessFile.java trunk/core/src/classpath/java/java/net/DatagramSocket.java trunk/core/src/classpath/vm/gnu/java/nio/VMPipe.java trunk/core/src/classpath/vm/gnu/java/nio/VMSelector.java trunk/core/src/classpath/vm/java/io/VMOpenMode.java trunk/core/src/classpath/vm/java/nio/channels/VMChannels.java trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java Added Paths: ----------- trunk/core/src/classpath/gnu/gnu/java/nio/channels/FileChannelImpl.java Removed Paths: ------------- trunk/core/src/classpath/gnu/gnu/java/nio/EpollSelectionKeyImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/EpollSelectorImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/FileChannelImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/KqueueSelectionKeyImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/KqueueSelectorImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/NIOSocketImpl.java trunk/core/src/classpath/gnu/gnu/java/nio/VMChannelOwner.java trunk/core/src/classpath/vm/gnu/java/net/ trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java trunk/core/src/core/org/jnode/vm/VmChannel.java Modified: trunk/core/src/classpath/gnu/gnu/java/net/PlainDatagramSocketImpl.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/net/PlainDatagramSocketImpl.java 2006-12-14 21:06:58 UTC (rev 2930) +++ trunk/core/src/classpath/gnu/gnu/java/net/PlainDatagramSocketImpl.java 2006-12-15 01:51:58 UTC (rev 2931) @@ -1,5 +1,5 @@ /* PlainDatagramSocketImpl.java -- Default DatagramSocket implementation - Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,10 +38,7 @@ package gnu.java.net; -import gnu.java.nio.VMChannel; - import java.io.IOException; -import java.io.InterruptedIOException; import java.net.DatagramPacket; import java.net.DatagramSocketImpl; import java.net.InetAddress; @@ -49,8 +46,8 @@ import java.net.NetworkInterface; import java.net.SocketAddress; import java.net.SocketException; -import java.net.SocketTimeoutException; -import java.nio.ByteBuffer; +import java.net.SocketOptions; +import gnu.classpath.Configuration; /** * Written using on-line Java Platform 1.2 API Specification, as well @@ -68,12 +65,17 @@ */ public final class PlainDatagramSocketImpl extends DatagramSocketImpl { - private final VMChannel channel; - + // @vm-specific removed System.loadLibrary + /** - * The platform-specific socket implementation. + * Option id for the IP_TTL (time to live) value. */ - private final VMPlainSocketImpl impl; + private static final int IP_TTL = 0x1E61; // 7777 + + /** + * This is the actual underlying file descriptor + */ + int native_fd = -1; /** * Lock object to serialize threads wanting to receive @@ -88,26 +90,24 @@ /** * Default do nothing constructor */ - public PlainDatagramSocketImpl() throws IOException + public PlainDatagramSocketImpl() { - channel = new VMChannel(); - impl = new VMPlainSocketImpl(channel); } - /*protected void finalize() throws Throwable + protected void finalize() throws Throwable { synchronized (this) { - if (channel.getState().isValid()) + if (native_fd != -1) close(); } super.finalize(); - }*/ + } - /*public int getNativeFD() + public int getNativeFD() { return native_fd; - }*/ + } /** * Binds this socket to a particular port and interface @@ -120,20 +120,9 @@ protected synchronized void bind(int port, InetAddress addr) throws SocketException { - try - { - impl.bind(new InetSocketAddress(addr, port)); - } - catch (SocketException se) - { - throw se; - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** @@ -141,58 +130,13 @@ * * @exception SocketException If an error occurs */ - protected synchronized void create() throws SocketException - { - try - { - channel.initSocket(false); - } - catch (SocketException se) - { - throw se; - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } + protected synchronized void create() throws SocketException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** - * Connects to the remote address and port specified as arguments. - * - * @param addr The remote address to connect to - * @param port The remote port to connect to - * - * @exception SocketException If an error occurs - */ - protected void connect(InetAddress addr, int port) throws SocketException - { - channel.connect(new InetSocketAddress(addr, port), 0); - } - - /** - * Disconnects the socket. - * - * @since 1.4 - */ - protected void disconnect() - { - synchronized (this) - { - try - { - if (channel.getState().isValid()) - channel.disconnect(); - } - catch (IOException ioe) - { - } - } - } - - /** * Sets the Time to Live value for the socket * * @param ttl The new TTL value @@ -201,7 +145,7 @@ */ protected synchronized void setTimeToLive(int ttl) throws IOException { - impl.setTimeToLive(ttl); + setOption(IP_TTL, new Integer(ttl)); } /** @@ -213,60 +157,48 @@ */ protected synchronized int getTimeToLive() throws IOException { - return impl.getTimeToLive(); - } + Object obj = getOption(IP_TTL); - protected int getLocalPort() - { - if (channel == null) - return -1; + if (! (obj instanceof Integer)) + throw new IOException("Internal Error"); - try - { - InetSocketAddress local = channel.getLocalAddress(); - if (local == null) - return -1; - return local.getPort(); - } - catch (IOException ioe) - { - return -1; - } + return ((Integer) obj).intValue(); } /** * Sends a packet of data to a remote host * + * @param addr The address to send to + * @param port The port to send to + * @param buf The buffer to send + * @param offset The offset of the data in the buffer to send + * @param len The length of the data to send + * + * @exception IOException If an error occurs + */ + private void sendto (InetAddress addr, int port, + byte[] buf, int offset, int len) + throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); + } + + /** + * Sends a packet of data to a remote host + * * @param packet The packet to send * * @exception IOException If an error occurs */ protected void send(DatagramPacket packet) throws IOException { - synchronized (SEND_LOCK) + synchronized(SEND_LOCK) { - ByteBuffer buf = ByteBuffer.wrap(packet.getData(), - packet.getOffset(), - packet.getLength()); - InetAddress remote = packet.getAddress(); - int port = packet.getPort(); - if (remote == null) - throw new NullPointerException(); - if (port <= 0) - throw new SocketException("invalid port " + port); - while (true) - { - try - { - channel.send(buf, new InetSocketAddress(remote, port)); - break; - } - catch (InterruptedIOException ioe) - { - // Ignore; interrupted system call. - } - } + sendto(packet.getAddress(), packet.getPort(), packet.getData(), + packet.getOffset(), packet.getLength()); } + } /** @@ -279,123 +211,63 @@ protected void receive(DatagramPacket packet) throws IOException { - synchronized(RECEIVE_LOCK) - { - ByteBuffer buf = ByteBuffer.wrap(packet.getData(), - packet.getOffset(), - packet.getLength()); - SocketAddress addr = null; - while (true) - { - try - { - addr = channel.receive(buf); - break; - } - catch (SocketTimeoutException ste) - { - throw ste; - } - catch (InterruptedIOException iioe) - { - // Ignore. Loop. - } - } - if (addr != null) - packet.setSocketAddress(addr); - packet.setLength(buf.position() - packet.getOffset()); - } + synchronized(RECEIVE_LOCK) + { + receive0(packet); + } } + /** + * Native call to receive a UDP packet from the network + * + * @param packet The packet to fill in with the data received + * + * @exception IOException IOException If an error occurs + */ + private void receive0(DatagramPacket packet) throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); + } /** * Sets the value of an option on the socket * - * @param optionId The identifier of the option to set - * @param value The value of the option to set + * @param option_id The identifier of the option to set + * @param val The value of the option to set * * @exception SocketException If an error occurs */ - public synchronized void setOption(int optionId, Object value) - throws SocketException - { - switch (optionId) - { - case IP_MULTICAST_IF: - case IP_MULTICAST_IF2: - impl.setMulticastInterface(optionId, (InetAddress) value); - break; - - case IP_MULTICAST_LOOP: - case SO_BROADCAST: - case SO_KEEPALIVE: - case SO_OOBINLINE: - case TCP_NODELAY: - case IP_TOS: - case SO_LINGER: - case SO_RCVBUF: - case SO_SNDBUF: - case SO_TIMEOUT: - case SO_REUSEADDR: - impl.setOption(optionId, value); - return; - - default: - throw new SocketException("cannot set option " + optionId); - } + public synchronized void setOption(int option_id, Object val) + throws SocketException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** * Retrieves the value of an option on the socket * - * @param optionId The identifier of the option to retrieve + * @param option_id The identifier of the option to retrieve * * @return The value of the option * * @exception SocketException If an error occurs */ - public synchronized Object getOption(int optionId) - throws SocketException - { - if (optionId == SO_BINDADDR) - { - try - { - InetSocketAddress local = channel.getLocalAddress(); - if (local == null) - return null; - return local.getAddress(); - } - catch (SocketException se) - { - throw se; - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } - } - if (optionId == IP_MULTICAST_IF || optionId == IP_MULTICAST_IF2) - return impl.getMulticastInterface(optionId); - - return impl.getOption(optionId); + public synchronized Object getOption(int option_id) + throws SocketException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** * Closes the socket */ - protected synchronized void close() - { - try - { - if (channel.getState().isValid()) - channel.close(); - } - catch (IOException ioe) - { - } + protected synchronized void close() { + // @vm-specific no natives + //TODO implement me + throw new RuntimeException("Not implemented"); } /** @@ -433,9 +305,9 @@ * * @exception IOException If an error occurs */ - protected synchronized void join(InetAddress addr) throws IOException - { - impl.join(addr); + protected synchronized void join(InetAddress addr) throws IOException { + // @vm-specific no natives + throw new SocketException("Not implemented"); } /** @@ -445,9 +317,10 @@ * * @exception IOException If an error occurs */ - protected synchronized void leave(InetAddress addr) throws IOException - { - impl.leave(addr); + protected synchronized void leave(InetAddress addr) throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** @@ -465,22 +338,14 @@ } public void joinGroup(SocketAddress address, NetworkInterface netIf) - throws IOException { - if (address == null) - throw new NullPointerException(); - if (!(address instanceof InetSocketAddress)) - throw new SocketException("unknown address type"); - impl.joinGroup((InetSocketAddress) address, netIf); + throw new InternalError + ("PlainDatagramSocketImpl::joinGroup is not implemented"); } public void leaveGroup(SocketAddress address, NetworkInterface netIf) - throws IOException { - if (address == null) - throw new NullPointerException(); - if (!(address instanceof InetSocketAddress)) - throw new SocketException("unknown address type"); - impl.leaveGroup((InetSocketAddress) address, netIf); + throw new InternalError + ("PlainDatagramSocketImpl::leaveGroup is not implemented"); } } Modified: trunk/core/src/classpath/gnu/gnu/java/net/PlainSocketImpl.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/net/PlainSocketImpl.java 2006-12-14 21:06:58 UTC (rev 2930) +++ trunk/core/src/classpath/gnu/gnu/java/net/PlainSocketImpl.java 2006-12-15 01:51:58 UTC (rev 2931) @@ -39,20 +39,16 @@ package gnu.java.net; -import gnu.java.nio.SocketChannelImpl; -import gnu.java.nio.VMChannel; - import java.io.InputStream; import java.io.IOException; -import java.io.InterruptedIOException; import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.net.SocketException; import java.net.SocketImpl; -import java.net.SocketTimeoutException; -import java.nio.ByteBuffer; +import java.net.SocketOptions; +import gnu.classpath.Configuration; /** * Written using on-line Java Platform 1.2 API Specification, as well @@ -70,13 +66,25 @@ * @author Nic Ferrier (nfe...@ta...) * @author Aaron M. Renn (ar...@ur...) */ -public class PlainSocketImpl extends SocketImpl +public final class PlainSocketImpl extends SocketImpl { + // Static initializer to load native library. + static + { + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("javanet"); + } + } /** - * The underlying plain socket VM implementation. + * The OS file handle representing the socket. + * This is used for reads and writes to/from the socket and + * to close it. + * + * When the socket is closed this is reset to -1. */ - protected VMPlainSocketImpl impl; + int native_fd = -1; /** * A cached copy of the in stream for reading from the socket. @@ -93,14 +101,8 @@ * is being invoked on this socket. */ private boolean inChannelOperation; - + /** - * The socket channel we use for IO operation. Package-private for - * use by inner classes. - */ - SocketChannelImpl channel; - - /** * Indicates whether we should ignore whether any associated * channel is set to non-blocking mode. Certain operations * throw an <code>IllegalBlockingModeException</code> if the @@ -122,44 +124,48 @@ } /** - * Default do nothing constructor. + * Default do nothing constructor */ public PlainSocketImpl() { - this.impl = new VMPlainSocketImpl(); } + + protected void finalize() throws Throwable + { + synchronized (this) + { + if (native_fd != -1) + try + { + close(); + } + catch (IOException ex) + { + } + } + super.finalize(); + } + public int getNativeFD() + { + return native_fd; + } + /** * Sets the specified option on a socket to the passed in object. For * options that take an integer argument, the passed in object is an * Integer. The option_id parameter is one of the defined constants in * this interface. * - * @param optionId The identifier of the option - * @param value The value to set the option to + * @param option_id The identifier of the option + * @param val The value to set the option to * - * @throws SocketException if an error occurs + * @exception SocketException If an error occurs */ - public void setOption(int optionId, Object value) throws SocketException - { - switch (optionId) - { - case SO_LINGER: - case IP_MULTICAST_LOOP: - case SO_BROADCAST: - case SO_KEEPALIVE: - case SO_OOBINLINE: - case TCP_NODELAY: - case IP_TOS: - case SO_RCVBUF: - case SO_SNDBUF: - case SO_TIMEOUT: - case SO_REUSEADDR: - impl.setOption(optionId, value); - return; - default: - throw new SocketException("Unrecognized TCP option: " + optionId); - } + public void setOption(int optID, Object value) throws SocketException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** @@ -167,144 +173,133 @@ * will be an Integer for options that have integer values. The option_id * is one of the defined constants in this interface. * - * @param optionId the option identifier + * @param option_id The option identifier * - * @return the current value of the option + * @return The current value of the option * - * @throws SocketException if an error occurs + * @exception SocketException If an error occurs */ - public Object getOption(int optionId) throws SocketException - { - if (optionId == SO_BINDADDR) - { - try - { - return channel.getVMChannel().getLocalAddress().getAddress(); - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } - } - - // This filters options which are invalid for TCP. - switch (optionId) - { - case SO_LINGER: - case IP_MULTICAST_LOOP: - case SO_BROADCAST: - case SO_KEEPALIVE: - case SO_OOBINLINE: - case TCP_NODELAY: - case IP_TOS: - case SO_RCVBUF: - case SO_SNDBUF: - case SO_TIMEOUT: - case SO_REUSEADDR: - return impl.getOption(optionId); - default: - throw new SocketException("Unrecognized TCP option: " + optionId); - } - + public Object getOption(int optID) throws SocketException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } - public void shutdownInput() throws IOException + /** + * Flushes the input stream and closes it. If you read from the input stream + * after calling this method a <code>IOException</code> will be thrown. + * + * @throws IOException if an error occurs + */ + public void shutdownInput() { - impl.shutdownInput(); + // @vm-specific no natives + //TODO implement me + throw new InternalError ("PlainSocketImpl::shutdownInput not implemented"); } + /** + * Flushes the output stream and closes it. If you write to the output stream + * after calling this method a <code>IOException</code> will be thrown. + * + * @throws IOException if an error occurs + */ public void shutdownOutput() throws IOException { - impl.shutdownOutput(); + // @vm-specific no natives + //TODO implement me + throw new InternalError ("PlainSocketImpl::shutdownOutput not implemented"); } /** * Creates a new socket that is not bound to any local address/port and - * is not connected to any remote address/port. The stream parameter will be - * ignored since PlainSocketImpl always is a stream socket. Datagram sockets - * are handled by PlainDatagramSocketImpl. + * is not connected to any remote address/port. This will be created as + * a stream socket if the stream parameter is true, or a datagram socket + * if the stream parameter is false. * - * @param stream <code>true</code> for stream sockets, <code>false</code> for - * datagram sockets + * @param stream true for a stream socket, false for a datagram socket */ - protected synchronized void create(boolean stream) throws IOException - { - channel = new SocketChannelImpl(false); - VMChannel vmchannel = channel.getVMChannel(); - vmchannel.initSocket(stream); - channel.configureBlocking(true); - impl.getState().setChannelFD(vmchannel.getState()); + protected synchronized void create(boolean stream) throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** * Connects to the remote hostname and port specified as arguments. * - * @param hostname the remote hostname to connect to - * @param port the remote port to connect to + * @param hostname The remote hostname to connect to + * @param port The remote port to connect to * - * @throws IOException If an error occurs + * @exception IOException If an error occurs */ - protected synchronized void connect(String hostname, int port) - throws IOException + protected synchronized void connect(String host, int port) throws IOException { - connect(InetAddress.getByName(hostname), port); + connect(InetAddress.getByName(host), port); } /** * Connects to the remote address and port specified as arguments. * - * @param addr the remote address to connect to - * @param port the remote port to connect to + * @param addr The remote address to connect to + * @param port The remote port to connect to * - * @throws IOException If an error occurs + * @exception IOException If an error occurs */ - protected void connect(InetAddress addr, int port) throws IOException - { - connect(new InetSocketAddress(addr, port), 0); + protected void connect(InetAddress addr, int port) throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** * Connects to the remote socket address with a specified timeout. * - * @param address the remote address to connect to - * @param timeout the timeout to use for this connect, 0 means infinite. + * @param timeout The timeout to use for this connect, 0 means infinite. * - * @throws IOException If an error occurs + * @exception IOException If an error occurs */ - protected synchronized void connect(SocketAddress address, int timeout) - throws IOException + protected synchronized void connect(SocketAddress address, int timeout) throws IOException { - if (channel == null) - create(true); - boolean connected = channel.connect(address, timeout); - if (!connected) - throw new SocketTimeoutException("connect timed out"); + InetSocketAddress sockAddr = (InetSocketAddress) address; + InetAddress addr = sockAddr.getAddress(); + + if (addr == null) + throw new IllegalArgumentException("address is unresolved: " + sockAddr); + + int port = sockAddr.getPort(); - // Using the given SocketAddress is important to preserve - // hostnames given by the caller. - InetSocketAddress addr = (InetSocketAddress) address; - this.address = addr.getAddress(); - this.port = addr.getPort(); + if (timeout < 0) + throw new IllegalArgumentException("negative timeout"); + + Object oldTimeoutObj = null; + + try + { + oldTimeoutObj = this.getOption (SocketOptions.SO_TIMEOUT); + this.setOption (SocketOptions.SO_TIMEOUT, new Integer (timeout)); + connect (addr, port); + } + finally + { + if (oldTimeoutObj != null) + this.setOption (SocketOptions.SO_TIMEOUT, oldTimeoutObj); + } } /** * Binds to the specified port on the specified addr. Note that this addr * must represent a local IP address. **** How bind to INADDR_ANY? **** * - * @param addr the address to bind to - * @param port the port number to bind to + * @param addr The address to bind to + * @param port The port number to bind to * - * @throws IOException if an error occurs + * @exception IOException If an error occurs */ protected synchronized void bind(InetAddress addr, int port) - throws IOException - { - if (channel == null) - create(true); - impl.bind(new InetSocketAddress(addr, port)); - localport = channel.getVMChannel().getLocalAddress().getPort(); + throws IOException { + // @vm-specific no natives + throw new SocketException("Not implemented"); } /** @@ -315,12 +310,13 @@ * * @param queuelen The length of the pending connection queue * - * @throws IOException If an error occurs + * @exception IOException If an error occurs */ protected synchronized void listen(int queuelen) - throws IOException - { - impl.listen(queuelen); + throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** @@ -330,64 +326,78 @@ * @param impl The SocketImpl object to accept this connection. */ protected synchronized void accept(SocketImpl impl) - throws IOException - { - if (channel == null) - create(true); - if (!(impl instanceof PlainSocketImpl)) - throw new IOException("incompatible SocketImpl: " - + impl.getClass().getName()); - PlainSocketImpl that = (PlainSocketImpl) impl; - VMChannel c = channel.getVMChannel().accept(); - that.impl.getState().setChannelFD(c.getState()); - that.channel = new SocketChannelImpl(c); - that.setOption(SO_REUSEADDR, Boolean.TRUE); - // Reset the inherited timeout. - that.setOption(SO_TIMEOUT, Integer.valueOf(0)); - + throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** * Returns the number of bytes that the caller can read from this socket * without blocking. * - * @return the number of readable bytes before blocking + * @return The number of readable bytes before blocking * - * @throws IOException if an error occurs + * @exception IOException If an error occurs */ - protected int available() throws IOException - { - if (channel == null) - throw new SocketException("not connected"); - return channel.getVMChannel().available(); + protected int available() throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } /** * Closes the socket. This will cause any InputStream or OutputStream * objects for this Socket to be closed as well. - * * <p> * Note that if the SO_LINGER option is set on this socket, then the * operation could block. - * </p> * - * @throws IOException if an error occurs + * @exception IOException If an error occurs */ - protected void close() throws IOException - { - if (impl.getState().isValid()) - impl.close(); - - address = null; - port = -1; + protected void close() throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); } - public void sendUrgentData(int data) throws IOException + public void sendUrgentData(int data) { - impl.sendUrgentData(data); + throw new InternalError ("PlainSocketImpl::sendUrgentData not implemented"); } /** + * Internal method used by SocketInputStream for reading data from + * the connection. Reads up to len bytes of data into the buffer + * buf starting at offset bytes into the buffer. + * + * @return The actual number of bytes read or -1 if end of stream. + * + * @exception IOException If an error occurs + */ + protected int read(byte[] buf, int offset, int len) + throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); + + } + + /** + * Internal method used by SocketOuputStream for writing data to + * the connection. Writes up to len bytes of data from the buffer + * buf starting at offset bytes into the buffer. + * + * @exception IOException If an error occurs + */ + protected void write(byte[] buf, int offset, int len) + throws IOException { + // @vm-specific no natives + //TODO implement me + throw new SocketException("Not implemented"); + } + + /** * Returns an InputStream object for reading from this socket. This will * be an instance of SocketInputStream. * @@ -399,7 +409,7 @@ { if (in == null) in = new SocketInputStream(); - + return in; } @@ -415,104 +425,15 @@ { if (out == null) out = new SocketOutputStream(); - + return out; } - - public VMChannel getVMChannel() - { - if (channel == null) - return null; - return channel.getVMChannel(); - } - /* (non-Javadoc) - * @see java.net.SocketImpl#getInetAddress() - */ - protected InetAddress getInetAddress() - { - if (channel == null) - return null; - - try - { - InetSocketAddress remote = channel.getVMChannel().getPeerAddress(); - if (remote == null) - return null; - // To mimic behavior of the RI the InetAddress instance which was - // used to establish the connection is returned instead of one that - // was created by the native layer (this preserves exact hostnames). - if (address != null) - return address; - - return remote.getAddress(); - } - catch (IOException ioe) - { - return null; - } - } - - /* (non-Javadoc) - * @see java.net.SocketImpl#getLocalPort() - */ - protected int getLocalPort() - { - if (channel == null) - return -1; - try - { - InetSocketAddress local = channel.getVMChannel().getLocalAddress(); - if (local == null) - return -1; - return local.getPort(); - } - catch (IOException ioe) - { - return -1; - } - } - - public InetSocketAddress getLocalAddress() - { - if (channel == null) - return null; - try - { - return channel.getVMChannel().getLocalAddress(); - } - catch (IOException ioe) - { - return null; - } - } - - /* (non-Javadoc) - * @see java.net.SocketImpl#getPort() - */ - protected int getPort() - { - if (channel == null) - return -1; - - try - { - InetSocketAddress remote = channel.getVMChannel().getPeerAddress(); - if (remote == null) - return -1; - return remote.getPort(); - } - catch (IOException ioe) - { - return -1; - } - } - /** * This class contains an implementation of <code>InputStream</code> for * sockets. It in an internal only class used by <code>PlainSocketImpl</code>. * - * @author Nic Ferrier <nfe...@ta...> + * @author Nic Ferrier (nfe...@ta...) */ final class SocketInputStream extends InputStream @@ -544,23 +465,13 @@ */ public int read() throws IOException { - if (channel == null) - throw new SocketException("not connected"); - while (true) - { - try - { - return channel.getVMChannel().read(); - } - catch (SocketTimeoutException ste) - { - throw ste; - } - catch (InterruptedIOException iioe) - { - // Ignore; NIO may throw this; net io shouldn't - } - } + byte buf[] = new byte [1]; + int bytes_read = read(buf, 0, 1); + + if (bytes_read == -1) + return -1; + + return buf[0] & 0xFF; } /** @@ -577,24 +488,12 @@ */ public int read (byte[] buf, int offset, int len) throws IOException { - if (channel == null) - throw new SocketException("not connected"); - ByteBuffer b = ByteBuffer.wrap(buf, offset, len); - while (true) - { - try - { - return channel.read(b); - } - catch (SocketTimeoutException ste) - { - throw ste; - } - catch (InterruptedIOException iioe) - { - // Ignored; NIO may throw this; net IO not. - } - } + int bytes_read = PlainSocketImpl.this.read (buf, offset, len); + + if (bytes_read == 0) + return -1; + + return bytes_read; } } @@ -604,7 +503,7 @@ * <code>getOutputStream method</code>. It expects only to be used in that * context. * - * @author Nic Ferrier <nfe...@ta...> + * @author Nic Ferrier (nfe...@ta...) */ final class SocketOutputStream extends OutputStream @@ -630,20 +529,8 @@ */ public void write(int b) throws IOException { - if (channel == null) - throw new SocketException("not connected"); - while (true) - { - try - { - channel.getVMChannel().write(b); - return; - } - catch (InterruptedIOException iioe) - { - // Ignored. - } - } + byte buf[] = { (byte) b }; + write(buf, 0, 1); } /** @@ -658,21 +545,7 @@ */ public void write (byte[] buf, int offset, int len) throws IOException { - if (channel == null) - throw new SocketException("not connected"); - ByteBuffer b = ByteBuffer.wrap(buf, offset, len); - while (b.hasRemaining()) - { - try - { - if (channel.write(b) == -1) - throw new IOException("channel has been closed"); - } - catch (InterruptedIOException iioe) - { - // Ignored. - } - } + PlainSocketImpl.this.write (buf, offset, len); } } } Modified: trunk/core/src/classpath/gnu/gnu/java/nio/DatagramChannelImpl.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/nio/DatagramChannelImpl.java 2006-12-14 21:06:58 UTC (rev 2930) +++ trunk/core/src/classpath/gnu/gnu/java/nio/DatagramChannelImpl.java 2006-12-15 01:51:58 UTC (rev 2931) @@ -55,10 +55,8 @@ * @author Michael Koch */ public final class DatagramChannelImpl extends DatagramChannel - implements VMChannelOwner { private NIODatagramSocket socket; - private VMChannel channel; /** * Indicates whether this channel initiated whatever operation @@ -66,16 +64,6 @@ */ private boolean inChannelOperation; - protected DatagramChannelImpl (SelectorProvider provider) - throws IOException - { - super (provider); - socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this); - channel = new VMChannel(); - channel.initSocket(false); - configureBlocking(true); - } - /** * Indicates whether our datagram socket should ignore whether * we are set to non-blocking mode. Certain operations on our @@ -97,6 +85,14 @@ inChannelOperation = b; } + protected DatagramChannelImpl (SelectorProvider provider) + throws IOException + { + super (provider); + socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this); + configureBlocking(true); + } + public DatagramSocket socket () { return socket; @@ -105,13 +101,13 @@ protected void implCloseSelectableChannel () throws IOException { - channel.close(); + socket.close (); } protected void implConfigureBlocking (boolean blocking) throws IOException { - channel.setBlocking(blocking); + socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); } public DatagramChannel connect (SocketAddress remote) @@ -120,43 +116,29 @@ if (!isOpen()) throw new ClosedChannelException(); - try - { - channel.connect((InetSocketAddress) remote, 0); - } - catch (ClassCastException cce) - { - throw new IOException("unsupported socked address type"); - } + socket.connect (remote); return this; } public DatagramChannel disconnect () throws IOException { - channel.disconnect(); + socket.disconnect (); return this; } - public boolean isConnected() + public boolean isConnected () { - try - { - return channel.getPeerAddress() != null; - } - catch (IOException ioe) - { - return false; - } + return socket.isConnected (); } - + public int write (ByteBuffer src) throws IOException { if (!isConnected ()) throw new NotYetConnectedException (); - return channel.write(src); + return send (src, socket.getRemoteSocketAddress()); } public long write (ByteBuffer[] srcs, int offset, int length) @@ -170,11 +152,13 @@ || (length < 0) || (length > (srcs.length - offset))) throw new IndexOutOfBoundsException(); + + long result = 0; - /* We are connected, meaning we will write these bytes to - * the host we connected to, so we don't need to explicitly - * give the host. */ - return channel.writeGathering(srcs, offset, length); + for (int index = offset; index < offset + length; index++) + result += write (srcs [index]); + + return result; } public int read (ByteBuffer dst) @@ -183,7 +167,9 @@ if (!isConnected ()) throw new NotYetConnectedException (); - return channel.read(dst); + int remaining = dst.remaining(); + receive (dst); + return remaining - dst.remaining(); } public long read (ByteBuffer[] dsts, int offset, int length) @@ -198,8 +184,12 @@ || (length > (dsts.length - offset))) throw new IndexOutOfBoundsException(); - /* Likewise, see the comment int write above. */ - return channel.readScattering(dsts, offset, length); + long result = 0; + + for (int index = offset; index < offset + length; index++) + result += read (dsts [index]); + + return result; } public SocketAddress receive (ByteBuffer dst) @@ -210,14 +200,51 @@ try { - begin(); - return channel.receive(dst); + DatagramPacket packet; + int len = dst.remaining(); + + if (dst.hasArray()) + { + packet = new DatagramPacket (dst.array(), + dst.arrayOffset() + dst.position(), + len); + } + else + { + packet = new DatagramPacket (new byte [len], len); + } + + boolean completed = false; + + try + { + begin(); + setInChannelOperation(true); + socket.receive (packet); + completed = true; + } + finally + { + end (completed); + setInChannelOperation(false); + } + + if (!dst.hasArray()) + { + dst.put (packet.getData(), packet.getOffset(), packet.getLength()); + } + else + { + dst.position (dst.position() + packet.getLength()); + } + + return packet.getSocketAddress(); } - finally - { - end(true); - } + catch (SocketTimeoutException e) + { + return null; } + } public int send (ByteBuffer src, SocketAddress target) throws IOException @@ -225,18 +252,46 @@ if (!isOpen()) throw new ClosedChannelException(); - if (!(target instanceof InetSocketAddress)) - throw new IOException("can only send to inet socket addresses"); - - InetSocketAddress dst = (InetSocketAddress) target; - if (dst.isUnresolved()) + if (target instanceof InetSocketAddress + && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); - return channel.send(src, dst); + byte[] buffer; + int offset = 0; + int len = src.remaining(); + + if (src.hasArray()) + { + buffer = src.array(); + offset = src.arrayOffset() + src.position(); + } + else + { + buffer = new byte [len]; + src.get (buffer); } - - public VMChannel getVMChannel() + + DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); + + boolean completed = false; + try { - return channel; + begin(); + setInChannelOperation(true); + socket.send(packet); + completed = true; + } + finally + { + end (completed); + setInChannelOperation(false); + } + + if (src.hasArray()) + { + src.position (src.position() + len); + } + + return len; } } Modified: trunk/core/src/classpath/gnu/gnu/java/nio/DatagramChannelSelectionKey.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/nio/DatagramChannelSelectionKey.java 2006-12-14 21:06:58 UTC (rev 2930) +++ trunk/core/src/classpath/gnu/gnu/java/nio/DatagramChannelSelectionKey.java 2006-12-15 01:51:58 UTC (rev 2931) @@ -38,7 +38,6 @@ package gnu.java.nio; -import java.io.IOException; import java.nio.channels.spi.AbstractSelectableChannel; /** @@ -53,16 +52,10 @@ super (channel, selector); } - // FIXME don't use file descriptor integers public int getNativeFD() { - try - { - return ((DatagramChannelImpl) ch).getVMChannel().getState().getNativeFD(); - } - catch (IOException ioe) - { - throw new IllegalStateException(ioe); - } + NIODatagramSocket socket = + (NIODatagramSocket) ((DatagramChannelImpl) ch).socket(); + return socket.getPlainDatagramSocketImpl().getNativeFD(); } } Deleted: trunk/core/src/classpath/gnu/gnu/java/nio/EpollSelectionKeyImpl.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/nio/EpollSelectionKeyImpl.java 2006-12-14 21:06:58 UTC (rev 2930) +++ trunk/core/src/classpath/gnu/gnu/java/nio/EpollSelectionKeyImpl.java 2006-12-15 01:51:58 UTC (rev 2931) @@ -1,122 +0,0 @@ -/* EpollSelectionKeyImpl.java -- selection key for the epoll selector. - Copyright (C) 2006 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.nio; - -import java.io.IOException; -import java.nio.channels.CancelledKeyException; -import java.nio.channels.SelectableChannel; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; -import java.nio.channels.spi.AbstractSelectionKey; - -/** - * @author Casey Marshall (cs...@gn...) - */ -public class EpollSelectionKeyImpl extends AbstractSelectionKey -{ - final int fd; - private final EpollSelectorImpl selector; - private final SelectableChannel channel; - int interestOps; - int selectedOps; - int key; - boolean valid; - boolean cancelled; - - EpollSelectionKeyImpl(EpollSelectorImpl selector, - SelectableChannel channel, int fd) - { - this.selector = selector; - this.channel = channel; - this.fd = fd; - } - - /* (non-Javadoc) - * @see java.nio.channels.SelectionKey#channel() - */ - public SelectableChannel channel() - { - return channel; - } - - /* (non-Javadoc) - * @see java.nio.channels.SelectionKey#interestOps() - */ - public int interestOps() - { - return interestOps; - } - - /* (non-Javadoc) - * @see java.nio.channels.SelectionKey#interestOps(int) - */ - public SelectionKey interestOps(int ops) - { - if (cancelled) - throw new CancelledKeyException(); - if ((ops & ~(channel.validOps())) != 0) - throw new IllegalArgumentException("unsupported channel ops"); - try - { - selector.epoll_modify(this, ops); - interestOps = ops; - } - catch (IOException ioe) - { - throw new IllegalArgumentException(ioe); - } - return this; - } - - /* (non-Javadoc) - * @see java.nio.channels.SelectionKey#readyOps() - */ - public int readyOps() - { - return selectedOps; - } - - /* (non-Javadoc) - * @see java.nio.channels.SelectionKey#selector() - */ - public Selector selector() - { - return selector; - } -} Deleted: trunk/core/src/classpath/gnu/gnu/java/nio/EpollSelectorImpl.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/nio/EpollSelectorImpl.java 2006-12-14 21:06:58 UTC (rev 2930) +++ trunk/core/src/classpath/gnu/gnu/java/nio/EpollSelectorImpl.java 2006-12-15 01:51:58 UTC (rev 2931) @@ -1,399 +0,0 @@ -/* EpollSelectorImpl.java -- selector implementation using epoll - Copyright (C) 2006 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.nio; - -import gnu.classpath.Configuration; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.nio.channels.SelectableChannel; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; -import java.nio.channels.spi.AbstractSelectableChannel; -import java.nio.channels.spi.AbstractSelector; -import java.nio.channels.spi.SelectorProvider; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -/** - * An implementation of {@link Selector} that uses the epoll event - * notification mechanism on GNU/Linux. - * - * @author Casey Marshall (cs...@gn...) - */ -public class EpollSelectorImpl extends AbstractSelector -{ - // XXX is this reasonable? Does it matter? - private static final int DEFAULT_EPOLL_SIZE = 128; - private static final int sizeof_struct_epoll_event; - - private static final int OP_ACCEPT = SelectionKey.OP_ACCEPT; - private static final int OP_CONNECT = SelectionKey.OP_CONNECT; - private static final int OP_READ = SelectionKey.OP_READ; - private static final int OP_WRITE = SelectionKey.OP_WRITE; - - /** our epoll file descriptor. */ - private int epoll_fd; - - private final HashMap keys; - private Set selectedKeys; - private Thread waitingThread; - private ByteBuffer events; - - private static final int INITIAL_CAPACITY; - private static final int MAX_DOUBLING_CAPACITY; - private static final int CAPACITY_INCREMENT; - - static - { - if (Configuration.INIT_LOAD_LIBRARY) - System.loadLibrary("javanio"); - - if (epoll_supported()) - sizeof_struct_epoll_event = sizeof_struct(); - else - sizeof_struct_epoll_event = -1; - - INITIAL_CAPACITY = 64 * sizeof_struct_epoll_event; - MAX_DOUBLING_CAPACITY = 1024 * sizeof_struct_epoll_event; - CAPACITY_INCREMENT = 128 * sizeof_struct_epoll_event; - } - - public EpollSelectorImpl(SelectorProvider provider) - throws IOException - { - super(provider); - epoll_fd = epoll_create(DEFAULT_EPOLL_SIZE); - keys = new HashMap(); - selectedKeys = null; - events = ByteBuffer.allocateDirect(INITIAL_CAPACITY); - } - - /* (non-Javadoc) - * @see java.nio.channels.Selector#keys() - */ - public Set keys() - { - return new HashSet(keys.values()); - } - - /* (non-Javadoc) - * @see java.nio.channels.Selector#select() - */ - public int select() throws IOException - { - return doSelect(-1); - } - - /* (non-Javadoc) - * @see java.nio.channels.Selector#select(long) - */ - public int select(long timeout) throws IOException - { - if (timeout > Integer.MAX_VALUE) - throw new IllegalArgumentException("timeout is too large"); - if (timeout < 0) - throw new IllegalArgumentException("invalid timeout"); - return doSelect((int) timeout); - } - - private int doSelect(int timeout) throws IOException - { - synchronized (keys) - { - Set cancelledKeys = cancelledKeys(); - synchronized (cancelledKeys) - { - for (Iterator it = cancelledKeys.iterator(); it.hasNext(); ) - { - EpollSelectionKeyImpl key = (EpollSelectionKeyImpl) it.next(); - epoll_delete(epoll_fd, key.fd); - key.valid = false; - keys.remove(Integer.valueOf(key.fd)); - it.remove(); - deregister(key); - } - - // Clear out closed channels. The fds are removed from the epoll - // fd when closed, so there is no need to remove them manually. - for (Iterator it = keys.values().iterator(); it.hasNext(); ) - { - EpollSelectionKeyImpl key = (EpollSelectionKeyImpl) it.next(); - SelectableChannel ch = key.channel(); - if (ch instanceof VMChannelOwner) - { - if (!((VMChannelOwner) ch).getVMChannel().getState().isValid()) - it.remove(); - } - } - - // Don't bother if we have nothing to select. - if (keys.isEmpty()) - return 0; - - int ret; - try - { - begin(); - waitingThread = Thread.currentThread(); - ret = epoll_wait(epoll_fd, events, keys.size(), timeout); - } - finally - { - Thread.interrupted(); - waitingThread = null; - end(); - } - - HashSet s = new HashSet(ret); - for (int i = 0; i < ret; i++) - { - events.position(i * sizeof_struct_epoll_event); - ByteBuffer b = events.slice(); - int fd = selected_fd(b); - EpollSelectionKeyImpl key - = (EpollSelectionKeyImpl) keys.get(Integer.valueOf(fd)); - if (key == null) - throw new IOException("fd was selected, but no key found"); - key.selectedOps = selected_ops(b) & key.interestOps; - s.add(key); - } - - reallocateBuffer(); - - selectedKeys = s; - return ret; - } - } - } - - /* (non-Javadoc) - * @see java.nio.channels.Selector#selectedKeys() - */ - public Set selectedKeys() - { - if (selectedKeys == null) - return Collections.EMPTY_SET; - return selectedKeys; - } - - /* (non-Javadoc) - * @see java.nio.channels.Selector#selectNow() - */ - public int selectNow() throws IOException - { - return doSelect(0); - } - - /* (non-Javadoc) - * @see java.nio.channels.Selector#wakeup() - */ - public Selector wakeup() - { - try - { - waitingThread.interrupt(); - } - catch (NullPointerException npe) - { - // Ignored, thrown if we are not in a blocking op. - } - return this; - } - - /* (non-Javadoc) - * @see java.nio.channels.spi.AbstractSelector#implCloseSelector() - */ - protected void implCloseSelector() throws IOException - { - VMChannel.close(epoll_fd); - } - - /* (non-Javadoc) - * @see java.nio.channels.spi.AbstractSelector#register(java.nio.channels.spi.AbstractSelectableChannel, int, java.lang.Object) - */ - protected SelectionKey register(AbstractSelectableChannel ch, int ops, Object att) - { - if (!(ch instanceof VMChannelOwner)) - throw new IllegalArgumentException("unsupported channel type"); - - VMChannel channel = ((VMChannelOwner) ch).getVMChannel(); - try - { - int native_fd = channel.getState().getNativeFD(); - synchronized (keys) - { - if (keys.containsKey(Integer.valueOf(native_fd))) - throw new IllegalArgumentException("channel already registered"); - EpollSelectionKeyImpl result = - new EpollSelectionKeyImpl(this, ch, native_fd); - if ((ops & ~(ch.validOps())) != 0) - throw new IllegalArgumentException("invalid ops for channel"); - result.interestOps = ops; - result.selectedOps = 0; - result.valid = true; - result.attach(att); - result.key = System.identityHashCode(result); - epoll_add(epoll_fd, result.fd, ops); - keys.put(Integer.valueOf(native_fd), result); - reallocateBuffer(); - return result; - } - } - catch (IOException ioe) - { - throw new IllegalArgumentException(ioe); - } - } - - private void reallocateBuffer() - { - // Ensure we have enough space for all potential events that may be - // returned. - if (events.capacity() < keys.size() * sizeof_struct_epoll_event) - { - int cap = events.capacity(); - if (cap < MAX_DOUBLING_CAPACITY) - cap <<= 1; - else - cap += CAPACITY_INCREMENT; - events = ByteBuffer.allocateDirect(cap); - } - // Ensure that the events buffer is not too large, given the number of - // events registered. - else if (events.capacity() > keys.size() * sizeof_struct_epoll_event * 2 + 1 - && events.capacity() > INITIAL_CAPACITY) - { - int cap = events.capacity() >>> 1; - events = ByteBuffer.allocateDirect(cap); - } - } - - void epoll_modify(EpollSelectionKeyImpl key, int ops) throws IOException - { - epoll_modify(epoll_fd, key.fd, ops); - } - - /** - * Tell if epoll is supported by this system, and support was compiled in. - * - * @return True if this system supports event notification with epoll. - */ - public static native boolean epoll_supported(); - - - /** - * Returns the size of `struct epoll_event'. - * - * @return The size of `struct epoll_event'. - */ - private static native int sizeof_struct(); - - - /** - * Open a new epoll file descriptor. - * - * @param size The size... [truncated message content] |
From: <ans...@us...> - 2006-12-14 21:07:00
|
Revision: 2930 http://jnode.svn.sourceforge.net/jnode/?rev=2930&view=rev Author: ansari82 Date: 2006-12-14 13:06:58 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Added build file with remote debug JDWP commands to JVM Added Paths: ----------- branches/jikesRVM/dbuild.sh Added: branches/jikesRVM/dbuild.sh =================================================================== --- branches/jikesRVM/dbuild.sh (rev 0) +++ branches/jikesRVM/dbuild.sh 2006-12-14 21:06:58 UTC (rev 2930) @@ -0,0 +1,6 @@ +#!/bin/sh + +dir=`dirname $0` +java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xmx1576M -Xms128M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* + + Property changes on: branches/jikesRVM/dbuild.sh ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2006-12-14 19:47:31
|
Revision: 2929 http://jnode.svn.sourceforge.net/jnode/?rev=2929&view=rev Author: ansari82 Date: 2006-12-14 11:47:24 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Summary ------- This wide-ranging commit incorporates the JikesRVM runtime optimising compiler classes (com.ibm.JikesRVM.opt.*) into the JNode-Core source tree. Adapter/stub classes have been created to allow the optimising compiler to interface with JNode's runtime. These form the remaining com.ibm.JikesRVM.* packages (i.e. the non-opt packages). Changes to JNode ---------------- 1. Several classes and methods have had their visibility changed to public, or final attribute removed, or some basic methods added, so they can be accessed from com.ibm.JikesRVM.* adapter classes. Effort has been made to keep these changes to a minimum. 2. The L1A compiler has been modified to save and restore EBX and ESI at the start and end of a method, respectively. This is needed as the optimising compiler needs these to be non-volatile 3. Some methods have been added to org.vmmagic.unboxed.* magic classes. 4. Usage of magic classes has been modified so that they are not instantiated or compared to null. Although this has no effect on L1A, the optimising compiler recognises magic classes and does not allow them to be set to null, as they are not realy objects. The errors the opt-compiler throws are not helpful in this instance. 5. Added JNode-Core: core/src/test/org.jnode.test.jikesTests. This contains some basic tests for the opt-compiler. 6. Added appropriate descriptors to include opt-compiler into the system jar. Notes ----- 1. The aim of this project has been to perform the minimum modification to both the opt compiler sources and the JNode sources. However, changes have occurred in both, and the changes in the JNode sources are outlined above (see commit transcript for detailed info). The changes to JNode have been tested and not found to break the existing build.or running environment. 2. Magic class variables should NOT be instaniated, set, or compared to null. This is illegal because they are not really objects. See the class descriptions for various methods to substitute null, e.g. Address myAddr = Address.Zero() instead of Address myAddr = null, or myAddr.isZero() instead of myAddr == null. Although comparison of magic variables does work, you should still do, e.g., myAddr.EQ(otherAddr), instead of myAddr == otherAddr. Bugs ---- 1. The build system has become unstable, and usually requires several runs of clean/cd-x86-lite before a successful build. The error is almost always a RuntimeException on VmSharedStatics during the 'java-image' ant task. This needs to be resolved urgently as it greatly impedes testing of bug fixes. 2. Opt-compiled code with yieldpoints does not work. Yieldpoints are critical, and need fixing 3. Opt-compiler class-init-test and object-init-test needs more scrutiny. Short-term To Do's ------------------ 1. Fix opt compiler to state where it boots image: the amount of bytecode combinations tested by successfully booting an image is close enough to saying the port is complete Long-term To Do's ----------------- 1. Implement an adaptive system that automatically opt-compiles hot methods at runtime. 2. Move JNode sources changes into trunk, move opt compiler changes into JikesRVM trunk. For those that we can't do, move into adapter classes to reduce the effort in integrating new versions of JNode and the optimising compiler. Modified Paths: -------------- branches/jikesRVM/all/conf/system-plugin-list.xml branches/jikesRVM/build.sh branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java branches/jikesRVM/core/src/core/org/jnode/assembler/x86/X86TextAssembler.java branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmCompiledCode.java branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmMember.java branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmStatics.java branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmType.java branches/jikesRVM/core/src/core/org/jnode/vm/compiler/CompiledMethod.java branches/jikesRVM/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java branches/jikesRVM/core/src/core/org/jnode/vm/memmgr/def/VmDefaultHeap.java branches/jikesRVM/core/src/core/org/jnode/vm/scheduler/MonitorManager.java branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/X86CompilerConstants.java branches/jikesRVM/core/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java branches/jikesRVM/core/src/test/org/jnode/test/core/CompilerTest.java branches/jikesRVM/core/src/vmmagic/org/vmmagic/unboxed/Offset.java branches/jikesRVM/core/src/vmmagic/org/vmmagic/unboxed/WordArray.java Added Paths: ----------- branches/jikesRVM/core/descriptors/com.ibm.JikesRVM.xml branches/jikesRVM/core/src/core/com/ branches/jikesRVM/core/src/core/com/ibm/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/OSR/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/OSR/OSR_AdjustBCIndexes.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/OSR/OSR_Constants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/OSR/OSR_EncodedOSRMap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/OSR/OSR_LocalRegPair.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/OSR/OSR_MethodVariables.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/OSR/OSR_ObjectHolder.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/OSR/OSR_VariableMap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/OSR/OSR_VariableMapElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/PrintLN.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Assembler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_AssemblerConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_BootRecord.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_BranchProfile.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_BranchProfiles.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Callbacks.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_CodeArray.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_CommandLineArgs.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_CompiledMethod.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_CompiledMethods.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Compiler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ConditionalBranchProfile.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Constants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_DynamicLink.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_EdgeCounts.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Entrypoints.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ExceptionDeliverer.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ExceptionTable.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ForwardReference.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_HeapLayoutConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Helper.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Lister.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Lock.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_MachineCode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Magic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_MagicNames.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Math.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Memory.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ObjectModel.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Options.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_OutOfLineMachineCode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Processor.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_RegisterConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Registers.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Runtime.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_SaveVolatile.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Scheduler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_SizeConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_StackBrowser.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_StackframeLayoutConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Statics.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_SwitchBranchProfile.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_TIBLayoutConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ThinLock.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ThinLockConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Thread.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Time.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_TrapConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_AOSDatabase.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_AOSOptions.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_AdaptiveInlining.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_CallSite.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_Controller.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_CounterBasedSampling.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_Instrumentation.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_MethodInvocationCounterData.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_PartialCallGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_StringEventCounterData.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_WeightedCallTargets.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/adaptive/VM_YieldpointCounterData.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/ApplicationClassLoader.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_AbstractMethod.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Array.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Atom.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_BootstrapClassLoader.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_BytecodeConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_BytecodeStream.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Class.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_ClassLoader.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_ClassLoaderConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_DynamicTypeCheck.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_ExceptionHandlerMap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Field.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_FieldReference.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_InterfaceInvocation.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_InterfaceMethodSignature.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Member.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MemberReference.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Method.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MethodReference.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_NativeMethod.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_NormalMethod.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Primitive.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_TableBasedDynamicLinker.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Type.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_TypeDescriptorParsing.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_TypeReference.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_TypeReferenceVector.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_UTF8Convert.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/memoryManagers/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/memoryManagers/mmInterface/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/memoryManagers/mmInterface/MM_Interface.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/memoryManagers/mmInterface/VM_GCMapIterator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_AdjustBranchProbabilities.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_AggregateReplacer.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_AnnotatedLSTGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_AnnotatedLSTNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Assembler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_AssemblerBase.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_Common_Helpers.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_Debug.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_Definitions.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_Helpers.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_IntConstantTreeNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_MemOp_Helpers.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_STATE.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_TreeNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BitSet.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BitSetMapping.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BitVector.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Bits.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BlockCountSpillCost.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BrainDeadSpillCost.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BranchOptimizationDriver.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BranchOptimizations.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BranchSimplifier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BreadthFirstEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BuildLST.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CFGTransformations.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CallSite.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CallingConvention.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ClassLoaderProxy.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ClassLoadingDependencyManager.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ClassSummary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Coalesce.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CoalesceGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CoalesceMoves.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CompilationPlan.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Compiler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CompilerPhase.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ComplexLIR2MIRExpansion.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CompoundEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Constants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ConvertALUOperators.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ConvertHIRtoLIR.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ConvertLIRtoMIR.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ConvertMIRtoMC.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ConvertToLowLevelIR.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DFS.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DFSenumerateByFinish.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DF_AbstractCell.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DF_Edge.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DF_Equation.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DF_Graph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DF_LatticeCell.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DF_Operator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DF_Solution.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DF_System.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DefUse.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DefaultInlineOracle.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DefaultPriority.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DepGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DepGraphConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DepGraphEdge.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DepGraphNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DepGraphStats.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DepthFirstEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Diamond.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DominanceFrontier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DominatorInfo.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DominatorTree.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DominatorTreeNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Dominators.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DominatorsPhase.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Dot.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DotConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DotEdge.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DotGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DotNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DotUtils.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DoublyLinkedList.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DoublyLinkedListElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DynamicTypeCheckExpansion.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_EdgelessGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_EdgelessGraphNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_EmptyEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_EmptyIterator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_EmptySet.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_EnterSSA.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_EnumerationIterator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_EscapeTransformations.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_EstimateBlockFrequencies.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ExpandCallingConvention.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ExpandFPRStackConvention.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ExpandRuntimeServices.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ExpressionFolding.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_FI_EscapeSummary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_FieldAnalysis.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_FieldDatabase.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_FilterEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_FilterIterator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_FilteredDFSenumerateByFinish.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_FinalMIRExpansion.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GCP.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GVCongruenceClass.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GenericPhysicalRegisterTools.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GenericRegisterPreferences.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GenericRegisterRestrictions.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GenericStackManager.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GlobalCSE.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GlobalValueNumber.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GlobalValueNumberState.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Graph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GraphEdge.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GraphEdgeFilter.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GraphElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GraphNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GraphNodeEnumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GraphUtilities.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_HeapVariable.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_IRPrinter.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_IndexPropagation.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_IndexPropagationSystem.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InlineDecision.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InlineOracle.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InlineTools.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InsertInstructionCounters.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InsertMethodInvocationCounter.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InsertYieldpointCounters.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InstrumentationPlan.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InstrumentationSamplingFramework.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InstrumentedEventCounterManager.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InterfaceHierarchy.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InvalidationDatabase.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_InvokeeThreadLocalContext.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_IteratorEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LICM.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LSTGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LSTNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LTDominatorInfo.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LTDominators.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LeaveSSA.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LinearScan.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LinkedList.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LinkedListElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LinkedListEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LinkedListObjectElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LinkedListObjectEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LinkedListSet.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ListPriority.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LiveAnalysis.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LiveInterval.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LiveIntervalElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LiveIntervalEnumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LiveRangeSplitting.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LiveSet.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LiveSetElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LiveSetEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LoadElimination.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LocalCSE.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LocalCastOptimization.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LocalConstantProp.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LocalCopyProp.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LoopAnalysis.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LoopUnrolling.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LoopVersioning.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_LowerInstrumentation.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_MIRBranchOptimizations.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_MIROptimizationPlanner.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_MIRSplitRanges.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_MagicNotImplementedException.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_MethodSummary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_MinimalBURS.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_MutateSplits.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_NormalBURS.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_NormalizeConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_NullCheckCombining.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ObjectReplacer.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_OperationNotImplementedException.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_OperatorClass.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_OptimizationPlanAtomicElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_OptimizationPlanCompositeElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_OptimizationPlanElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_OptimizationPlanner.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_OptimizingCompilerException.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Options.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Pair.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_PhysicalRegisterConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_PhysicalRegisterTools.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_PiNodes.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_PrePassScheduler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Priority.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_PrologueEpilogueCreator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Queue.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_RedundantBranchElimination.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_RegisterAllocator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_RegisterAllocatorState.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_RegisterPreferences.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_RegisterRestrictions.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ReorderingPhase.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ResourceMap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ResourceReservation.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ReverseDFS.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ReverseDFSenumerateByFinish.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ReverseEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ReverseFilteredDFSenumerateByFinish.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SCC.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SCC_Engine.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SCC_Enumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SCC_Graph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SCC_Vertex.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SSA.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SSADictionary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SSAOptions.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SSATuneUp.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Scheduler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SchedulingInfo.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ScratchMap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ShortArrayReplacer.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Simple.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SimpleEscape.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SimpleSpillCost.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Simplifier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SingletonIterator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SingletonSet.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SmallStack.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Solvable.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SortedGraphIterator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SortedGraphNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpaceEffGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpaceEffGraphEdge.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpaceEffGraphEdgeList.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpaceEffGraphEdgeListHeader.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpaceEffGraphNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpaceEffGraphNodeList.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpaceEffGraphNodeListHeader.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpecializationContext.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpecializationDatabase.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpecializedMethod.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpecializedMethodPool.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SpillCostEstimator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SplitBasicBlock.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Stack.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_StackManager.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_StaticFieldReader.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_StaticSplitting.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_SummaryDatabase.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_TailRecursionElimination.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_TopSort.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_TopSortInterface.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Tree.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_TreeBottomUpEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_TreeNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_TreeNodeChildrenEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_TreeTopDownEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_UnsyncReplacer.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_VCG.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_VCGConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_VCGEdge.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_VCGGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_VCGNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ValueGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ValueGraphEdge.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ValueGraphParamLabel.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ValueGraphVertex.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ValueNumberPair.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_VisEdge.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_VisGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_VisNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_YieldPoints.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OSR_OsrPointConstructor.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptCompiledMethod.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptEncodedCallSiteTree.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptExceptionDeliverer.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptExceptionTable.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptGCMap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptGCMapIterator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptGCMapIteratorConstants.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptGenericGCMapIterator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptLinker.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptMachineCodeMap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/VM_OptSaveVolatile.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/ALoad.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/AStore.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Athrow.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Attempt.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/BBend.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Binary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/BinaryAcc.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/BooleanCmp.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/BoundsCheck.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/BranchProfileCarrier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/CacheOp.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Call.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/CondMove.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Empty.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/GetField.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/GetStatic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Goto.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/GuardCarrier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/GuardResultCarrier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/GuardedBinary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/GuardedSet.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/GuardedUnary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/IfCmp.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/IfCmp2.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/InlineGuard.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/InstanceOf.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/InstrumentedCounter.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/JnodeMagic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Label.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Load.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/LocationCarrier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/LookupSwitch.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/LowTableSwitch.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_BinaryAcc.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Branch.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Call.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_CaseLabel.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Compare.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_CompareExchange.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_CondBranch.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_CondBranch2.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_CondMove.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_ConvertDW2QW.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Divide.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_DoubleShift.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Empty.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_FSave.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Lea.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_LowTableSwitch.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Move.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Multiply.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Nullary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_RDTSC.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Return.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Set.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Test.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Trap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_TrapIf.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_Unary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_UnaryAcc.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_UnaryNoRes.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MIR_XChng.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/MonitorOp.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Move.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Multianewarray.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/New.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/NewArray.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/NullCheck.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Nullary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_AbstractRegisterPool.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_AddressConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_BC2IR.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_BURSManagedFPROperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_BasicBlock.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_BasicBlockEnumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_BasicBlockOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_BranchOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_BranchProfileOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_CallSiteTree.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_CallSiteTreeNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_ClassConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_CompilationState.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_ConditionOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_ConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_ControlFlowGraph.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_ConvertBCtoHIR.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_DoubleConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_EmptyBasicBlockEnumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_EmptyInstructionEnumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_ExceptionHandlerBasicBlock.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_ExceptionHandlerBasicBlockBag.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_FloatConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GCIRMap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GCIRMapElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GCIRMapEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateMachineSpecificMagic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateMagic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerationContext.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenericPhysicalRegisterSet.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenericRegisterPool.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_HIRInfo.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_HeapOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_IA32ConditionOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_IR.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_IREnumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_IRGenOptions.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_IRSummary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_IRTools.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_InlineSequence.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_InlinedOsrTypeInfoOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_Inliner.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_Instruction.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_InstructionEnumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_InstructionFormat.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_IntConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_LIRInfo.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_LocationOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_LongConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_MIRInfo.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_MemoryOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_MethodOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_NullConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_Operand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_OperandEnumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_Operator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_OperatorNames.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_Operators.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_OsrTypeInfoOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_PhysicalDefUse.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_PhysicalRegisterSet.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_RegSpillListElement.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_RegSpillListEnumerator.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_Register.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_RegisterOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_RegisterOperandEnumeration.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_RegisterPool.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_StackLocationOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_StringConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_TrapCodeOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_TrueGuardOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_TypeOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_UnreachableOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_WeightedBranchTargets.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OsrBarrier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OsrPoint.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Phi.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Prepare.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Prologue.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/PutField.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/PutStatic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/ResultCarrier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Return.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Store.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/StoreCheck.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/TableSwitch.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Trap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/TrapIf.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/TypeCheck.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/Unary.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/UnaryAcc.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/ZeroCheck.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/util/ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/util/VM_HashMap.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/util/VM_HashSet.java branches/jikesRVM/core/src/test/org/jnode/test/JikesTest.java Modified: branches/jikesRVM/all/conf/system-plugin-list.xml =================================================================== --- branches/jikesRVM/all/conf/system-plugin-list.xml 2006-12-14 14:56:03 UTC (rev 2928) +++ branches/jikesRVM/all/conf/system-plugin-list.xml 2006-12-14 19:47:24 UTC (rev 2929) @@ -16,5 +16,6 @@ <plugin id="org.jnode.util"/> <plugin id="org.jnode.vm"/> <plugin id="org.jnode.vm.core"/> + <plugin id="com.ibm.JikesRVM"/> </plugin-list> Modified: branches/jikesRVM/build.sh =================================================================== --- branches/jikesRVM/build.sh 2006-12-14 14:56:03 UTC (rev 2928) +++ branches/jikesRVM/build.sh 2006-12-14 19:47:24 UTC (rev 2929) @@ -1,6 +1,6 @@ #!/bin/sh dir=`dirname $0` -java -Xmx512M -Xms128M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* +java -Xmx712M -Xms128M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* Modified: branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2006-12-14 14:56:03 UTC (rev 2928) +++ branches/jikesRVM/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2006-12-14 19:47:24 UTC (rev 2929) @@ -73,6 +73,14 @@ import org.jnode.vm.x86.compiler.X86CompilerConstants; import org.jnode.vm.x86.compiler.X86JumpTable; +import com.ibm.JikesRVM.VM; +import com.ibm.JikesRVM.VM_Processor; +import com.ibm.JikesRVM.VM_Thread; +import com.ibm.JikesRVM.classloader.VM_BootstrapClassLoader; +import com.ibm.JikesRVM.classloader.VM_Method; +import com.ibm.JikesRVM.classloader.VM_Type; +import com.ibm.JikesRVM.classloader.VM_TypeReference; + /** * @author epr */ @@ -279,6 +287,13 @@ loadClass(VmType.class); loadClass(VmSystem.class); loadClass(VmSystemObject.class); + loadClass(VM.class); + loadClass(VM_Method.class); + loadClass(VM_Processor.class); + loadClass(VM_BootstrapClassLoader.class); + loadClass(VM_Thread.class); + loadClass(VM_Type.class); + loadClass(VM_TypeReference.class); final X86BinaryAssembler.ObjectInfo initCodeObject = os .startObject(vmCodeClass); Added: branches/jikesRVM/core/descriptors/com.ibm.JikesRVM.xml =================================================================== --- branches/jikesRVM/core/descriptors/com.ibm.JikesRVM.xml (rev 0) +++ branches/jikesRVM/core/descriptors/com.ibm.JikesRVM.xml 2006-12-14 19:47:24 UTC (rev 2929) @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plugin SYSTEM "jnode.dtd"> + +<plugin id="com.ibm.JikesRVM" + name="JikesRVM OptCompiler classes" + version="@VERSION@" + system="true" + license-name="cpl" + provider-name="IBM"> + + <requires> + </requires> + + <runtime> + <library name="jnode-core.jar"> + <export name="com.ibm.JikesRVM.*"/> + <export name="com.ibm.JikesRVM.adaptive.*"/> + <export name="com.ibm.JikesRVM.classloader.*"/> + <export name="com.ibm.JikesRVM.opt.*"/> + <export name="com.ibm.JikesRVM.opt.ir.*"/> + <export name="com.ibm.JikesRVM.OSR.*"/> + <export name="com.ibm.JikesRVM.memoryManagers.mmInterface.*"/> + <export name="com.ibm.JikesRVM.util.*"/> + </library> + </runtime> + +</plugin> Added: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java (rev 0) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2006-12-14 19:47:24 UTC (rev 2929) @@ -0,0 +1,409 @@ +package com.ibm.JikesRVM; + +import org.jnode.assembler.Label; +import org.jnode.assembler.NativeStream; +import org.jnode.assembler.ObjectResolver; +import org.jnode.assembler.UnresolvedObjectRefException; +import org.jnode.assembler.x86.X86Assembler; +import org.jnode.assembler.x86.X86BinaryAssembler; +import org.jnode.vm.Vm; +import org.jnode.vm.VmAddress; +import org.jnode.vm.VmMagic; +import org.jnode.vm.classmgr.VmAddressMap; +import org.jnode.vm.classmgr.VmByteCode; +import org.jnode.vm.classmgr.VmCompiledExceptionHandler; +import org.jnode.vm.classmgr.VmConstClass; +import org.jnode.vm.classmgr.VmMethod; +import org.jnode.vm.compiler.CompileError; +import org.jnode.vm.compiler.CompiledExceptionHandler; +import org.jnode.vm.compiler.CompiledMethod; +import org.jnode.vm.compiler.CompilerBytecodeVisitor; +import org.jnode.vm.compiler.GCMapIterator; +import org.jnode.vm.scheduler.VmProcessor; +import org.jnode.vm.x86.X86CpuID; +import org.jnode.vm.x86.compiler.AbstractX86Compiler; +import org.vmmagic.unboxed.Address; + +import com.ibm.JikesRVM.classloader.VM_Method; +import com.ibm.JikesRVM.classloader.VM_NormalMethod; +import com.ibm.JikesRVM.classloader.VM_Type; +import com.ibm.JikesRVM.opt.OPT_CompilationPlan; +import com.ibm.JikesRVM.opt.OPT_Compiler; +import com.ibm.JikesRVM.opt.OPT_OptimizationPlanElement; +import com.ibm.JikesRVM.opt.OPT_OptimizationPlanner; +import com.ibm.JikesRVM.opt.OPT_OptimizingCompilerException; +import com.ibm.JikesRVM.opt.OPT_Options; +import com.ibm.JikesRVM.opt.VM_OptCompiledMethod; + +/** + * This is the main interface for JNode to use the optimizing compiler + * ported from JikesRVM + * + * @author Mohammad Ansari (ans...@us...) + */ + +public class JikesRVMOptCompiler extends AbstractX86Compiler { + + // is the opt compiler usable? + protected static boolean compilerEnabled = false; + protected static boolean compilationInProgress; + + public static OPT_Options options; + public static OPT_OptimizationPlanElement[] optimizationPlan; + private boolean init = false; + + public JikesRVMOptCompiler() { + options = new OPT_Options(); + optimizationPlan = OPT_OptimizationPlanner + .createOptimizationPlan(options); + VM.getVM(); + OPT_Compiler.init(options); + // VM_PreCompile.init();//Don't know what this is + compilerEnabled = true; + + } + + @Override + protected CompiledMethod doCompile(VmMethod method, NativeStream nos, int level, boolean isBootstrap) { + + VM_Magic.jikesCompiled=true; + final CompiledMethod cm; + if (method.isNative()) { + Object label = new Label(method.getMangledName()); + cm = new CompiledMethod(level); + cm.setCodeStart(nos.getObjectRef(label)); + } else { + //Prevent recursive compilation, but in JNode this may lead to deadlock + while(compilationInProgress) + ; + compilationInProgress = true; + //Initialise Jikes' VM_Magic + VM_Magic.init(getEntryPoints()); + //Create Jikes' version of the method to be compiled + VM_NormalMethod jikesMethod = (VM_NormalMethod)VM_Method.buildFromJnodeMethod(method); + //Create the optimization plan, the following is the default way to do it + OPT_CompilationPlan compPlan = + new OPT_CompilationPlan(jikesMethod, optimizationPlan, null, options); + //Compile with Jikes + VM_CompiledMethod jikescm = optCompileWithFallBackInternal(jikesMethod, compPlan); + //Build necessary result for JNode VM from Jikes compiled output + cm = ((VM_OptCompiledMethod)jikescm).buildJnodeCM((X86Assembler)nos, getEntryPoints()); + compilationInProgress = false; + } + return cm; + } + + private static VM_CompiledMethod optCompileWithFallBackInternal( + VM_NormalMethod method, OPT_CompilationPlan plan) { + if (method.hasNoOptCompilePragma()) + return fallback(method); + try { + plan.method = method; + plan.options = options; + return OPT_Compiler.compile(plan); + } + catch (OPT_OptimizingCompilerException e) { + e.printStackTrace(); + } + return fallback(method); + + } + + private static VM_CompiledMethod fallback(VM_NormalMethod method) { + // Some methods geniunely can't be optcompiled, so we need + // a way to fall back gracefully, this is a skeleton start. + return null; + } + + public static boolean compilableMethod(VmMethod vmMethod) { + if (vmMethod.getDeclaringClass().getName().contains("org.jnode.test") +// || vmMethod.getDeclaringClass().getName().contains("org.jnode.vm.classmgr") + ) { + return true; + } + else return false; + } + + @Override + public NativeStream createNativeStream(ObjectResolver resolver) { + X86CpuID cpuid = (X86CpuID) VmProcessor.current().getCPUID(); + X86BinaryAssembler os = new X86BinaryAssembler(cpuid, getMode(), 0); + os.setResolver(resolver); + return os; + } + + @Override + protected CompilerBytecodeVisitor createBytecodeVisitor(VmMethod method, + CompiledMethod cm, NativeStream os, int level, boolean isBootstrap) { + return null; + } + + @Override + public int getMagic() { + return JIKES_COMPILER_MAGIC; + } + + @Override + public String getName() { + return "JikesOpt"; + } + + @Override + public GCMapIterator createGCMapIterator() { + // TODO + return null; + } + + + @Override + public String[] getCompilerPackages() { + return new String[] { "org.jnode.vm.x86.compiler", + "com.ibm.JikesRVM", + "com.ibm.JikesRVM.adaptive", + "com.ibm.JikesRVM.classloader", + "com.ibm.JikesRVM.memoryManagers.mmInterface", + "com.ibm.JikesRVM.opt", + "com.ibm.JikesRVM.opt.ir", + "com.ibm.JikesRVM.OSR", + "com.ibm.JikesRVM.util"}; + } + + + + + public void compileBootstrap(VmMethod method, NativeStream os, + int level) { + int start = os.getLength(); + final CompiledMethod cm; + final boolean abstractM = method.isAbstract(); + if (abstractM) { + if (method.isStatic()) { + throw new Error("Abstract & static"); + } + if (method.isNative()) { + throw new Error("Abstract & native"); + } + cm = doCompileAbstract(method, os, level, true); + if (cm == null) { + return; + } + } else { + cm = doCompile(method, os, level, true); + } + int end = os.getLength(); + + final VmAddress nativeCode = (VmAddress) cm.getCodeStart().getObject(); + VmCompiledExceptionHandler[] eTable; + final VmAddress defExHandler; + final VmByteCode bc; + final VmAddressMap aTable = cm.getAddressTable(); + + if (!(method.isNative() || abstractM)) { + final NativeStream.ObjectRef defExHRef = cm + .getDefExceptionHandler(); + if (defExHRef != null) { + defExHandler = (VmAddress) defExHRef.getObject(); + ... [truncated message content] |
From: <hag...@us...> - 2006-12-14 14:56:05
|
Revision: 2928 http://jnode.svn.sourceforge.net/jnode/?rev=2928&view=rev Author: hagar-wize Date: 2006-12-14 06:56:03 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Classpath patches - with a stub class that needs to be worked on Modified Paths: -------------- trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java Added Paths: ----------- trunk/core/src/core/org/jnode/vm/VmChannel.java Modified: trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java =================================================================== --- trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java 2006-12-14 13:00:14 UTC (rev 2927) +++ trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java 2006-12-14 14:56:03 UTC (rev 2928) @@ -50,6 +50,8 @@ import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; +import org.jnode.vm.VmChannel; + /** * Native interface to support configuring of channel to run in a non-blocking * manner and support scatter/gather io operations. @@ -103,28 +105,25 @@ { System.loadLibrary ("javanio"); } - initIDs(); + VmChannel.initIDs(); } public static VMChannel getStdin() throws IOException { - return new VMChannel(stdin_fd()); + return new VMChannel(VmChannel.stdin_fd()); } public static VMChannel getStdout() throws IOException { - return new VMChannel(stdout_fd()); + return new VMChannel(VmChannel.stdout_fd()); } public static VMChannel getStderr() throws IOException { - return new VMChannel(stderr_fd()); + return new VMChannel(VmChannel.stderr_fd()); } - private static native int stdin_fd(); - private static native int stdout_fd(); - private static native int stderr_fd(); - + /** * Set the file descriptor to have the required blocking * setting. @@ -133,18 +132,15 @@ */ public void setBlocking(boolean blocking) throws IOException { - setBlocking(nfd.getNativeFD(), blocking); + VmChannel.setBlocking(nfd.getNativeFD(), blocking); } - private static native void setBlocking(int fd, boolean blocking) - throws IOException; - + public int available() throws IOException { - return available(nfd.getNativeFD()); + return VmChannel.available(nfd.getNativeFD()); } - private static native int available(int native_fd) throws IOException; /** * Reads a byte buffer directly using the supplied file descriptor. @@ -156,11 +152,9 @@ public int read(ByteBuffer dst) throws IOException { - return read(nfd.getNativeFD(), dst); + return VmChannel.read(nfd.getNativeFD(), dst); } - private static native int read(int fd, ByteBuffer dst) throws IOException; - /** * Read a single byte. * @@ -169,11 +163,10 @@ */ public int read() throws IOException { - return read(nfd.getNativeFD()); + return VmChannel.read(nfd.getNativeFD()); } - private static native int read(int fd) throws IOException; - + /** * Reads into byte buffers directly using the supplied file descriptor. * Assumes that the buffer list contains DirectBuffers. Will perform a @@ -191,13 +184,10 @@ if (offset + length > dsts.length) throw new IndexOutOfBoundsException("offset + length > dsts.length"); - return readScattering(nfd.getNativeFD(), dsts, offset, length); + return VmChannel.readScattering(nfd.getNativeFD(), dsts, offset, length); } - private static native long readScattering(int fd, ByteBuffer[] dsts, - int offset, int length) - throws IOException; - + /** * Receive a datagram on this channel, returning the host address * that sent the datagram. @@ -211,7 +201,7 @@ if (kind != Kind.SOCK_DGRAM) throw new SocketException("not a datagram socket"); ByteBuffer hostPort = ByteBuffer.allocateDirect(18); - int hostlen = receive(nfd.getNativeFD(), dst, hostPort); + int hostlen = VmChannel.receive(nfd.getNativeFD(), dst, hostPort); if (hostlen == 0) return null; if (hostlen == 4) // IPv4 @@ -233,9 +223,6 @@ + hostlen); } - private static native int receive (int fd, ByteBuffer dst, ByteBuffer address) - throws IOException; - /** * Writes from a direct byte bufer using the supplied file descriptor. * Assumes the buffer is a DirectBuffer. @@ -246,10 +233,9 @@ */ public int write(ByteBuffer src) throws IOException { - return write(nfd.getNativeFD(), src); + return VmChannel.write(nfd.getNativeFD(), src); } - private native int write(int fd, ByteBuffer src) throws IOException; /** * Writes from byte buffers directly using the supplied file descriptor. @@ -284,13 +270,10 @@ if (length > srcs.length - offset) length = srcs.length - offset; - return writeGathering(nfd.getNativeFD(), srcs, offset, length); + return VmChannel.writeGathering(nfd.getNativeFD(), srcs, offset, length); } - private native long writeGathering(int fd, ByteBuffer[] srcs, - int offset, int length) - throws IOException; - + /** * Send a datagram to the given address. * @@ -306,21 +289,13 @@ if (addr == null) throw new NullPointerException(); if (addr instanceof Inet4Address) - return send(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort()); + return VmChannel.send(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort()); else if (addr instanceof Inet6Address) - return send6(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort()); + return VmChannel.send6(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort()); else throw new SocketException("unrecognized inet address type"); } - // Send to an IPv4 address. - private static native int send(int fd, ByteBuffer src, byte[] addr, int port) - throws IOException; - - // Send to an IPv6 address. - private static native int send6(int fd, ByteBuffer src, byte[] addr, int port) - throws IOException; - /** * Write a single byte. * @@ -329,12 +304,9 @@ */ public void write(int b) throws IOException { - write(nfd.getNativeFD(), b); + VmChannel.write(nfd.getNativeFD(), b); } - private static native void write(int fd, int b) throws IOException; - - private native static void initIDs(); // Network (socket) specific methods. @@ -355,17 +327,9 @@ kind = Kind.SOCK_STREAM; else kind = Kind.SOCK_DGRAM; - nfd.setNativeFD(socket(stream)); + nfd.setNativeFD(VmChannel.socket(stream)); } - /** - * Create a new socket, returning the native file descriptor. - * - * @param stream Set to true for streaming sockets; false for datagrams. - * @return The native file descriptor. - * @throws IOException If creating the socket fails. - */ - private static native int socket(boolean stream) throws IOException; /** * Connect the underlying socket file descriptor to the remote host. @@ -396,20 +360,14 @@ } if (addr instanceof Inet4Address) - return connect(fd, addr.getAddress(), saddr.getPort(), + return VmChannel.connect(fd, addr.getAddress(), saddr.getPort(), timeout); if (addr instanceof Inet6Address) - return connect6(fd, addr.getAddress(), saddr.getPort(), + return VmChannel.connect6(fd, addr.getAddress(), saddr.getPort(), timeout); throw new SocketException("unsupported internet address"); } - private static native boolean connect(int fd, byte[] addr, int port, int timeout) - throws SocketException; - - private static native boolean connect6(int fd, byte[] addr, int port, int timeout) - throws SocketException; - /** * Disconnect this channel, if it is a datagram socket. Disconnecting * a datagram channel will disassociate it from any address, so the @@ -423,17 +381,16 @@ { if (kind != Kind.SOCK_DGRAM) throw new IOException("can only disconnect datagram channels"); - disconnect(nfd.getNativeFD()); + VmChannel.disconnect(nfd.getNativeFD()); } - private static native void disconnect(int fd) throws IOException; - + public InetSocketAddress getLocalAddress() throws IOException { if (!nfd.isValid()) return null; ByteBuffer name = ByteBuffer.allocateDirect(18); - int namelen = getsockname(nfd.getNativeFD(), name); + int namelen = VmChannel.getsockname(nfd.getNativeFD(), name); if (namelen == 0) // not bound return null; // XXX return some wildcard? if (namelen == 4) @@ -453,9 +410,6 @@ throw new SocketException("invalid address length"); } - private static native int getsockname(int fd, ByteBuffer name) - throws IOException; - /** * Returns the socket address of the remote peer this channel is connected * to, or null if this channel is not yet connected. @@ -468,7 +422,7 @@ if (!nfd.isValid()) return null; ByteBuffer name = ByteBuffer.allocateDirect(18); - int namelen = getpeername (nfd.getNativeFD(), name); + int namelen = VmChannel.getpeername (nfd.getNativeFD(), name); if (namelen == 0) // not connected yet return null; if (namelen == 4) // IPv4 @@ -488,14 +442,7 @@ throw new SocketException("invalid address length"); } - /* - * The format here is the peer address, followed by the port number. - * The returned value is the length of the peer address; thus, there - * will be LEN + 2 valid bytes put into NAME. - */ - private static native int getpeername(int fd, ByteBuffer name) - throws IOException; - + /** * Accept an incoming connection, returning a new VMChannel, or null * if the channel is nonblocking and no connection is pending. @@ -505,14 +452,12 @@ */ public VMChannel accept() throws IOException { - int new_fd = accept(nfd.getNativeFD()); + int new_fd = VmChannel.accept(nfd.getNativeFD()); if (new_fd == -1) // non-blocking accept had no pending connection return null; return new VMChannel(new_fd); } - private static native int accept(int native_fd) throws IOException; - // File-specific methods. /** @@ -527,91 +472,76 @@ { if (nfd.isValid() || nfd.isClosed()) throw new IOException("can't reinitialize this channel"); - int fd = open(path, mode); + int fd = VmChannel.open(path, mode); nfd.setNativeFD(fd); kind = Kind.FILE; } - private static native int open(String path, int mode) throws IOException; - + public long position() throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); - return position(nfd.getNativeFD()); + return VmChannel.position(nfd.getNativeFD()); } - private static native long position(int fd) throws IOException; - + public void seek(long pos) throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); - seek(nfd.getNativeFD(), pos); + VmChannel.seek(nfd.getNativeFD(), pos); } - private static native void seek(int fd, long pos) throws IOException; public void truncate(long length) throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); - truncate(nfd.getNativeFD(), length); + VmChannel.truncate(nfd.getNativeFD(), length); } - private static native void truncate(int fd, long len) throws IOException; - + public boolean lock(long pos, long len, boolean shared, boolean wait) throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); - return lock(nfd.getNativeFD(), pos, len, shared, wait); + return VmChannel.lock(nfd.getNativeFD(), pos, len, shared, wait); } - private static native boolean lock(int fd, long pos, long len, - boolean shared, boolean wait) - throws IOException; - + public void unlock(long pos, long len) throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); - unlock(nfd.getNativeFD(), pos, len); + VmChannel.unlock(nfd.getNativeFD(), pos, len); } - private static native void unlock(int fd, long pos, long len) throws IOException; - + public long size() throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); - return size(nfd.getNativeFD()); + return VmChannel.size(nfd.getNativeFD()); } - private static native long size(int fd) throws IOException; - public MappedByteBuffer map(char mode, long position, int size) throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); - return map(nfd.getNativeFD(), mode, position, size); + return VmChannel.map(nfd.getNativeFD(), mode, position, size); } - private static native MappedByteBuffer map(int fd, char mode, - long position, int size) - throws IOException; - + public boolean flush(boolean metadata) throws IOException { if (kind != Kind.FILE) throw new IOException("not a file"); - return flush(nfd.getNativeFD(), metadata); + return VmChannel.flush(nfd.getNativeFD(), metadata); } - private static native boolean flush(int fd, boolean metadata) throws IOException; - // Close. /** @@ -626,8 +556,7 @@ nfd.close(); } - static native void close(int native_fd) throws IOException; - + /** * <p>Provides a simple mean for the JNI code to find out whether the * current thread was interrupted by a call to Thread.interrupt().</p> @@ -696,7 +625,7 @@ throw new IOException("invalid file descriptor"); try { - VMChannel.close(native_fd); + VmChannel.close(native_fd); } finally { Added: trunk/core/src/core/org/jnode/vm/VmChannel.java =================================================================== --- trunk/core/src/core/org/jnode/vm/VmChannel.java (rev 0) +++ trunk/core/src/core/org/jnode/vm/VmChannel.java 2006-12-14 14:56:03 UTC (rev 2928) @@ -0,0 +1,118 @@ +package org.jnode.vm; + +import gnu.classpath.Configuration; +import gnu.java.nio.VMChannel; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.MappedByteBuffer; +import java.net.*; + +/** + * Native interface to support configuring of channel to run in a non-blocking + * manner and support scatter/gather io operations. + * + * @author + * + */ +public final class VmChannel +{ + + public static int stdin_fd(){return 0;} + public static int stdout_fd(){return 0;} + public static int stderr_fd(){return 0;} + + public static void setBlocking(int fd, boolean blocking) + throws IOException{} + + public static int available(int native_fd) throws IOException{return 0;} + + public static int read(int fd, ByteBuffer dst) throws IOException{return 0;} + + + public static int read(int fd) throws IOException{return 0;} + public static long readScattering(int fd, ByteBuffer[] dsts, + int offset, int length) + throws IOException{return 0;} + + + public static int receive (int fd, ByteBuffer dst, ByteBuffer address) + throws IOException{return 0;} + + public static int write(int fd, ByteBuffer src) throws IOException{return 0;} + + public static long writeGathering(int fd, ByteBuffer[] srcs, + int offset, int length) + throws IOException{return 0;} + + // Send to an IPv4 address. + public static int send(int fd, ByteBuffer src, byte[] addr, int port) + throws IOException{return 0;} + + // Send to an IPv6 address. + public static int send6(int fd, ByteBuffer src, byte[] addr, int port) + throws IOException{return 0;} + + public static void write(int fd, int b) throws IOException{} + + public static void initIDs(){} + + // Network (socket) specific methods. + + + /** + * Create a new socket, returning the native file descriptor. + * + * @param stream Set to true for streaming sockets{} false for datagrams. + * @return The native file descriptor. + * @throws java.io.IOException If creating the socket fails. + */ + public static int socket(boolean stream) throws IOException{return 0;} + + + public static boolean connect(int fd, byte[] addr, int port, int timeout) + throws SocketException{return false;} + + public static boolean connect6(int fd, byte[] addr, int port, int timeout) + throws SocketException{return false;} + + public static void disconnect(int fd) throws IOException{} + + public static int getsockname(int fd, ByteBuffer name) + throws IOException{return 0;} + + /* + * The format here is the peer address, followed by the port number. + * The returned value is the length of the peer address{} thus, there + * will be LEN + 2 valid bytes put into NAME. + */ + public static int getpeername(int fd, ByteBuffer name) + throws IOException{return 0;} + + public static int accept(int native_fd) throws IOException{return 0;} + + + public static int open(String path, int mode) throws IOException{return 0;} + + public static long position(int fd) throws IOException{return 0;} + + public static void seek(int fd, long pos) throws IOException{} + + public static void truncate(int fd, long len) throws IOException{} + + public static boolean lock(int fd, long pos, long len, + boolean shared, boolean wait) + throws IOException{return false;} + + public static void unlock(int fd, long pos, long len) throws IOException{} + + public static long size(int fd) throws IOException{return 0;} + + public static MappedByteBuffer map(int fd, char mode, + long position, int size) + throws IOException{return null;} + + public static boolean flush(int fd, boolean metadata) throws IOException{return false;} + + public static void close(int native_fd) throws IOException{} +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2006-12-14 13:00:17
|
Revision: 2927 http://jnode.svn.sourceforge.net/jnode/?rev=2927&view=rev Author: hagar-wize Date: 2006-12-14 05:00:14 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Classpath patches Modified Paths: -------------- trunk/core/src/classpath/java/java/net/DatagramSocket.java Modified: trunk/core/src/classpath/java/java/net/DatagramSocket.java =================================================================== --- trunk/core/src/classpath/java/java/net/DatagramSocket.java 2006-12-14 12:58:38 UTC (rev 2926) +++ trunk/core/src/classpath/java/java/net/DatagramSocket.java 2006-12-14 13:00:14 UTC (rev 2927) @@ -1,5 +1,5 @@ /* DatagramSocket.java -- A class to model UDP sockets - Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005 + Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -8,7 +8,7 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -42,12 +42,10 @@ import gnu.java.net.PlainDatagramSocketImpl; import gnu.java.nio.DatagramChannelImpl; -import gnu.java.security.action.GetPropertyAction; import java.io.IOException; import java.nio.channels.DatagramChannel; import java.nio.channels.IllegalBlockingModeException; -import java.security.AccessController; /** @@ -56,47 +54,47 @@ * Status: Believed complete and correct. */ /** - * This class models a connectionless datagram socket that sends + * This class models a connectionless datagram socket that sends * individual packets of data across the network. In the TCP/IP world, * this means UDP. Datagram packets do not have guaranteed delivery, * or any guarantee about the order the data will be received on the * remote host. - * + * * @author Aaron M. Renn (ar...@ur...) * @author Warren Levy (wa...@cy...) * @date May 3, 1999. */ public class DatagramSocket { - /** - * This is the user DatagramSocketImplFactory for this class. If this - * variable is null, a default factory is used. - */ + /** + * This is the user DatagramSocketImplFactory for this class. If this + * variable is null, a default factory is used. + */ private static DatagramSocketImplFactory factory; - /** - * This is the implementation object used by this socket. - */ + /** + * This is the implementation object used by this socket. + */ private DatagramSocketImpl impl; - /** + /** * True if socket implementation was created. - */ + */ private boolean implCreated; - /** - * This is the address we are "connected" to - */ - private InetAddress remoteAddress; + /** + * This is the address we are "connected" to + */ + private InetAddress remoteAddress; - /** - * This is the port we are "connected" to - */ - private int remotePort = -1; + /** + * This is the port we are "connected" to + */ + private int remotePort = -1; - /** + /** * True if socket is bound. - */ + */ private boolean bound; /** @@ -118,77 +116,83 @@ this.remotePort = -1; } - /** - * Initializes a new instance of <code>DatagramSocket</code> that binds to - * a random port and every address on the local machine. - * - * @exception SocketException If an error occurs. - * @exception SecurityException If a security manager exists and + /** + * Initializes a new instance of <code>DatagramSocket</code> that binds to + * a random port and every address on the local machine. + * + * @exception SocketException If an error occurs. + * @exception SecurityException If a security manager exists and * its <code>checkListen</code> method doesn't allow the operation. - */ + */ public DatagramSocket() throws SocketException { this(new InetSocketAddress(0)); - } + } - /** - * Initializes a new instance of <code>DatagramSocket</code> that binds to - * the specified port and every address on the local machine. - * - * @param port The local port number to bind to. - * - * @exception SecurityException If a security manager exists and its + /** + * Initializes a new instance of <code>DatagramSocket</code> that binds to + * the specified port and every address on the local machine. + * + * @param port The local port number to bind to. + * + * @exception SecurityException If a security manager exists and its * <code>checkListen</code> method doesn't allow the operation. - * @exception SocketException If an error occurs. - */ + * @exception SocketException If an error occurs. + */ public DatagramSocket(int port) throws SocketException { this(new InetSocketAddress(port)); - } + } - /** - * Initializes a new instance of <code>DatagramSocket</code> that binds to - * the specified local port and address. - * - * @param port The local port number to bind to. + /** + * Initializes a new instance of <code>DatagramSocket</code> that binds to + * the specified local port and address. + * + * @param port The local port number to bind to. * @param addr The local address to bind to. - * - * @exception SecurityException If a security manager exists and its - * checkListen method doesn't allow the operation. - * @exception SocketException If an error occurs. - */ + * + * @exception SecurityException If a security manager exists and its + * checkListen method doesn't allow the operation. + * @exception SocketException If an error occurs. + */ public DatagramSocket(int port, InetAddress addr) throws SocketException { this(new InetSocketAddress(addr, port)); - } + } - /** - * Initializes a new instance of <code>DatagramSocket</code> that binds to - * the specified local port and address. - * + /** + * Initializes a new instance of <code>DatagramSocket</code> that binds to + * the specified local port and address. + * * @param address The local address and port number to bind to. - * - * @exception SecurityException If a security manager exists and its + * + * @exception SecurityException If a security manager exists and its * <code>checkListen</code> method doesn't allow the operation. - * @exception SocketException If an error occurs. - * - * @since 1.4 - */ + * @exception SocketException If an error occurs. + * + * @since 1.4 + */ public DatagramSocket(SocketAddress address) throws SocketException { - // @classpath-bugfix Security - //String propVal = SystemProperties.getProperty("impl.prefix"); - //if (propVal == null || propVal.equals("")) - String propVal = (String)AccessController.doPrivileged(new GetPropertyAction("impl.prefix")); - // @classpath-bugfix-end - - // @classpath-bugfix Use factory - //if (propVal == null || propVal.equals("")) - if (factory != null) { - impl = factory.createDatagramSocketImpl(); - } else if (propVal == null || propVal.equals("")) - // @classpath-bugfix-end - impl = new PlainDatagramSocketImpl(); + String propVal = SystemProperties.getProperty("impl.prefix"); + if (propVal == null || propVal.equals("")) + { + if (factory != null) + impl = factory.createDatagramSocketImpl(); + else + { + try + { + impl = new PlainDatagramSocketImpl(); + } + catch (IOException ioe) + { + SocketException se = new SocketException(); + se.initCause(ioe); + throw se; + } + } + } else try { @@ -201,7 +205,16 @@ { System.err.println("Could not instantiate class: java.net." + propVal + "DatagramSocketImpl"); - impl = new PlainDatagramSocketImpl(); + try + { + impl = new PlainDatagramSocketImpl(); + } + catch (IOException ioe) + { + SocketException se = new SocketException(); + se.initCause(ioe); + throw se; + } } if (address != null) @@ -217,21 +230,21 @@ { impl.create(); implCreated = true; - } + } return impl; - } + } catch (IOException e) { SocketException se = new SocketException(); se.initCause(e); throw se; - } - } + } + } - /** - * Closes this datagram socket. - */ + /** + * Closes this datagram socket. + */ public void close() { if (isClosed()) @@ -261,47 +274,47 @@ { // Do nothing. } - } + } - /** - * This method returns the remote address to which this socket is - * connected. If this socket is not connected, then this method will - * return <code>null</code>. - * - * @return The remote address. - * - * @since 1.2 - */ + /** + * This method returns the remote address to which this socket is + * connected. If this socket is not connected, then this method will + * return <code>null</code>. + * + * @return The remote address. + * + * @since 1.2 + */ public InetAddress getInetAddress() { - return remoteAddress; - } + return remoteAddress; + } - /** - * This method returns the remote port to which this socket is - * connected. If this socket is not connected, then this method will - * return -1. - * - * @return The remote port. - * - * @since 1.2 - */ + /** + * This method returns the remote port to which this socket is + * connected. If this socket is not connected, then this method will + * return -1. + * + * @return The remote port. + * + * @since 1.2 + */ public int getPort() { - return remotePort; - } + return remotePort; + } - /** - * Returns the local address this datagram socket is bound to. - * + /** + * Returns the local address this datagram socket is bound to. + * * @return The local address is the socket is bound or null * - * @since 1.1 - */ + * @since 1.1 + */ public InetAddress getLocalAddress() { if (! isBound()) - return null; + return null; InetAddress localAddr; @@ -312,7 +325,7 @@ SecurityManager s = System.getSecurityManager(); if (s != null) - s.checkConnect(localAddr.getHostName(), -1); + s.checkConnect(localAddr.getHostAddress(), -1); } catch (SecurityException e) { @@ -325,13 +338,13 @@ } return localAddr; - } + } - /** - * Returns the local port this socket is bound to. - * - * @return The local port number. - */ + /** + * Returns the local port this socket is bound to. + * + * @return The local port number. + */ public int getLocalPort() { if (isClosed()) @@ -346,18 +359,18 @@ // This cannot happen as we are bound. return 0; } - } + } - /** - * Returns the value of the socket's SO_TIMEOUT setting. If this method - * returns 0 then SO_TIMEOUT is disabled. - * - * @return The current timeout in milliseconds. - * - * @exception SocketException If an error occurs. - * - * @since 1.1 - */ + /** + * Returns the value of the socket's SO_TIMEOUT setting. If this method + * returns 0 then SO_TIMEOUT is disabled. + * + * @return The current timeout in milliseconds. + * + * @exception SocketException If an error occurs. + * + * @since 1.1 + */ public synchronized int getSoTimeout() throws SocketException { if (isClosed()) @@ -369,41 +382,41 @@ return ((Integer) buf).intValue(); throw new SocketException("unexpected type"); - } + } - /** - * Sets the value of the socket's SO_TIMEOUT value. A value of 0 will - * disable SO_TIMEOUT. Any other value is the number of milliseconds - * a socket read/write will block before timing out. - * - * @param timeout The new SO_TIMEOUT value in milliseconds. - * - * @exception SocketException If an error occurs. - * - * @since 1.1 - */ + /** + * Sets the value of the socket's SO_TIMEOUT value. A value of 0 will + * disable SO_TIMEOUT. Any other value is the number of milliseconds + * a socket read/write will block before timing out. + * + * @param timeout The new SO_TIMEOUT value in milliseconds. + * + * @exception SocketException If an error occurs. + * + * @since 1.1 + */ public synchronized void setSoTimeout(int timeout) throws SocketException { if (isClosed()) throw new SocketException("socket is closed"); - if (timeout < 0) + if (timeout < 0) throw new IllegalArgumentException("Invalid timeout: " + timeout); getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout)); - } + } - /** - * This method returns the value of the system level socket option - * SO_SNDBUF, which is used by the operating system to tune buffer - * sizes for data transfers. - * - * @return The send buffer size. - * - * @exception SocketException If an error occurs. - * - * @since 1.2 - */ + /** + * This method returns the value of the system level socket option + * SO_SNDBUF, which is used by the operating system to tune buffer + * sizes for data transfers. + * + * @return The send buffer size. + * + * @exception SocketException If an error occurs. + * + * @since 1.2 + */ public int getSendBufferSize() throws SocketException { if (isClosed()) @@ -415,42 +428,42 @@ return ((Integer) buf).intValue(); throw new SocketException("unexpected type"); - } + } - /** - * This method sets the value for the system level socket option - * SO_SNDBUF to the specified value. Note that valid values for this - * option are specific to a given operating system. - * - * @param size The new send buffer size. - * - * @exception SocketException If an error occurs. - * @exception IllegalArgumentException If size is 0 or negative. - * - * @since 1.2 - */ + /** + * This method sets the value for the system level socket option + * SO_SNDBUF to the specified value. Note that valid values for this + * option are specific to a given operating system. + * + * @param size The new send buffer size. + * + * @exception SocketException If an error occurs. + * @exception IllegalArgumentException If size is 0 or negative. + * + * @since 1.2 + */ public void setSendBufferSize(int size) throws SocketException { if (isClosed()) throw new SocketException("socket is closed"); - if (size < 0) - throw new IllegalArgumentException("Buffer size is less than 0"); + if (size < 0) + throw new IllegalArgumentException("Buffer size is less than 0"); getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size)); - } + } - /** - * This method returns the value of the system level socket option - * SO_RCVBUF, which is used by the operating system to tune buffer - * sizes for data transfers. - * - * @return The receive buffer size. - * - * @exception SocketException If an error occurs. - * - * @since 1.2 - */ + /** + * This method returns the value of the system level socket option + * SO_RCVBUF, which is used by the operating system to tune buffer + * sizes for data transfers. + * + * @return The receive buffer size. + * + * @exception SocketException If an error occurs. + * + * @since 1.2 + */ public int getReceiveBufferSize() throws SocketException { if (isClosed()) @@ -462,58 +475,57 @@ return ((Integer) buf).intValue(); throw new SocketException("unexpected type"); - } + } - /** - * This method sets the value for the system level socket option - * SO_RCVBUF to the specified value. Note that valid values for this - * option are specific to a given operating system. - * - * @param size The new receive buffer size. - * - * @exception SocketException If an error occurs. - * @exception IllegalArgumentException If size is 0 or negative. - * - * @since 1.2 - */ + /** + * This method sets the value for the system level socket option + * SO_RCVBUF to the specified value. Note that valid values for this + * option are specific to a given operating system. + * + * @param size The new receive buffer size. + * + * @exception SocketException If an error occurs. + * @exception IllegalArgumentException If size is 0 or negative. + * + * @since 1.2 + */ public void setReceiveBufferSize(int size) throws SocketException { if (isClosed()) throw new SocketException("socket is closed"); - if (size < 0) - throw new IllegalArgumentException("Buffer size is less than 0"); + if (size < 0) + throw new IllegalArgumentException("Buffer size is less than 0"); getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size)); - } + } - /** - * This method connects this socket to the specified address and port. - * When a datagram socket is connected, it will only send or receive + /** + * This method connects this socket to the specified address and port. + * When a datagram socket is connected, it will only send or receive * packets to and from the host to which it is connected. A multicast - * socket that is connected may only send and not receive packets. - * + * socket that is connected may only send and not receive packets. + * * @param address The address to connect this socket to. - * @param port The port to connect this socket to. - * - * @exception SocketException If an error occurs. + * @param port The port to connect this socket to. + * * @exception IllegalArgumentException If address or port are invalid. * @exception SecurityException If the caller is not allowed to send * datagrams to or receive from this address and port. - * - * @since 1.2 - */ + * + * @since 1.2 + */ public void connect(InetAddress address, int port) { if (address == null) throw new IllegalArgumentException("Connect address may not be null"); - if ((port < 1) || (port > 65535)) + if ((port < 1) || (port > 65535)) throw new IllegalArgumentException("Port number is illegal: " + port); - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkConnect(address.getHostName(), port); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkConnect(address.getHostAddress(), port); try { @@ -525,15 +537,15 @@ { // This means simply not connected or connect not implemented. } - } + } - /** + /** * This method disconnects this socket from the address/port it was - * connected to. If the socket was not connected in the first place, - * this method does nothing. - * - * @since 1.2 - */ + * connected to. If the socket was not connected in the first place, + * this method does nothing. + * + * @since 1.2 + */ public void disconnect() { if (! isConnected()) @@ -552,16 +564,16 @@ remoteAddress = null; remotePort = -1; } - } + } - /** - * Reads a datagram packet from the socket. Note that this method - * will block until a packet is received from the network. On return, - * the passed in <code>DatagramPacket</code> is populated with the data - * received and all the other information about the packet. - * - * @param p A <code>DatagramPacket</code> for storing the data - * + /** + * Reads a datagram packet from the socket. Note that this method + * will block until a packet is received from the network. On return, + * the passed in <code>DatagramPacket</code> is populated with the data + * received and all the other information about the packet. + * + * @param p A <code>DatagramPacket</code> for storing the data + * * @exception IOException If an error occurs. * @exception SocketTimeoutException If setSoTimeout was previously called * and the timeout has expired. @@ -572,7 +584,7 @@ * channel, and the channel is in non-blocking mode. * @exception SecurityException If a security manager exists and its * checkAccept method doesn't allow the receive. - */ + */ public synchronized void receive(DatagramPacket p) throws IOException { if (isClosed()) @@ -586,43 +598,49 @@ && ! ((DatagramChannelImpl) getChannel()).isInChannelOperation()) throw new IllegalBlockingModeException(); - getImpl().receive(p); + DatagramPacket p2 = new DatagramPacket(p.getData(), p.getOffset(), p.maxlen); + getImpl().receive(p2); + p.length = p2.length; + if (p2.getAddress() != null) + p.setAddress(p2.getAddress()); + if (p2.getPort() != -1) + p.setPort(p2.getPort()); - SecurityManager s = System.getSecurityManager(); - if (s != null && isConnected()) - s.checkAccept(p.getAddress().getHostName(), p.getPort()); - } + SecurityManager s = System.getSecurityManager(); + if (s != null && isConnected()) + s.checkAccept(p.getAddress().getHostAddress(), p.getPort()); + } - /** - * Sends the specified packet. The host and port to which the packet - * are to be sent should be set inside the packet. - * - * @param p The datagram packet to send. - * - * @exception IOException If an error occurs. - * @exception SecurityException If a security manager exists and its - * checkMulticast or checkConnect method doesn't allow the send. - * @exception PortUnreachableException If the socket is connected to a - * currently unreachable destination. Note, there is no guarantee that the - * exception will be thrown. - * @exception IllegalBlockingModeException If this socket has an associated - * channel, and the channel is in non-blocking mode. - */ + /** + * Sends the specified packet. The host and port to which the packet + * are to be sent should be set inside the packet. + * + * @param p The datagram packet to send. + * + * @exception IOException If an error occurs. + * @exception SecurityException If a security manager exists and its + * checkMulticast or checkConnect method doesn't allow the send. + * @exception PortUnreachableException If the socket is connected to a + * currently unreachable destination. Note, there is no guarantee that the + * exception will be thrown. + * @exception IllegalBlockingModeException If this socket has an associated + * channel, and the channel is in non-blocking mode. + */ public void send(DatagramPacket p) throws IOException { if (isClosed()) throw new SocketException("socket is closed"); // JDK1.2: Don't do security checks if socket is connected; see jdk1.2 api. - SecurityManager s = System.getSecurityManager(); + SecurityManager s = System.getSecurityManager(); if (s != null && ! isConnected()) { - InetAddress addr = p.getAddress(); - if (addr.isMulticastAddress()) - s.checkMulticast(addr); - else - s.checkConnect(addr.getHostAddress(), p.getPort()); - } + InetAddress addr = p.getAddress(); + if (addr.isMulticastAddress()) + s.checkMulticast(addr); + else + s.checkConnect(addr.getHostAddress(), p.getPort()); + } if (isConnected()) { @@ -630,7 +648,7 @@ && (remoteAddress != p.getAddress() || remotePort != p.getPort())) throw new IllegalArgumentException ("DatagramPacket address does not match remote address"); - } + } // FIXME: if this is a subclass of MulticastSocket, // use getTimeToLive for TTL val. @@ -639,24 +657,27 @@ throw new IllegalBlockingModeException(); getImpl().send(p); - } + } - /** - * Binds the socket to the given socket address. - * - * @param address The socket address to bind to. - * - * @exception SocketException If an error occurs. - * @exception SecurityException If a security manager exists and - * its checkListen method doesn't allow the operation. - * @exception IllegalArgumentException If address type is not supported. - * - * @since 1.4 - */ + /** + * Binds the socket to the given socket address. + * + * @param address The socket address to bind to. + * + * @exception SocketException If an error occurs. + * @exception SecurityException If a security manager exists and + * its checkListen method doesn't allow the operation. + * @exception IllegalArgumentException If address type is not supported. + * + * @since 1.4 + */ public void bind(SocketAddress address) throws SocketException { if (isClosed()) throw new SocketException("socket is closed"); + + if (address == null) + address = new InetSocketAddress(InetAddress.ANY_IF, 0); if (! (address instanceof InetSocketAddress)) throw new IllegalArgumentException("unsupported address type"); @@ -667,8 +688,8 @@ if (port < 0 || port > 65535) throw new IllegalArgumentException("Invalid port: " + port); - SecurityManager s = System.getSecurityManager(); - if (s != null) + SecurityManager s = System.getSecurityManager(); + if (s != null) s.checkListen(port); if (addr == null) @@ -706,30 +727,30 @@ public boolean isClosed() { return impl == null; - } + } - /** - * Returns the datagram channel assoziated with this datagram socket. - * + /** + * Returns the datagram channel assoziated with this datagram socket. + * * @return The associated <code>DatagramChannel</code> object or null * - * @since 1.4 - */ + * @since 1.4 + */ public DatagramChannel getChannel() { return null; - } + } - /** - * Connects the datagram socket to a specified socket address. - * - * @param address The socket address to connect to. - * - * @exception SocketException If an error occurs. - * @exception IllegalArgumentException If address type is not supported. - * - * @since 1.4 - */ + /** + * Connects the datagram socket to a specified socket address. + * + * @param address The socket address to connect to. + * + * @exception SocketException If an error occurs. + * @exception IllegalArgumentException If address type is not supported. + * + * @since 1.4 + */ public void connect(SocketAddress address) throws SocketException { if (isClosed()) @@ -739,90 +760,90 @@ throw new IllegalArgumentException("unsupported address type"); InetSocketAddress tmp = (InetSocketAddress) address; - connect(tmp.getAddress(), tmp.getPort()); - } + connect(tmp.getAddress(), tmp.getPort()); + } - /** - * Returns the binding state of the socket. - * + /** + * Returns the binding state of the socket. + * * @return True if socket bound, false otherwise. * - * @since 1.4 - */ + * @since 1.4 + */ public boolean isBound() { return bound; - } + } - /** - * Returns the connection state of the socket. - * + /** + * Returns the connection state of the socket. + * * @return True if socket is connected, false otherwise. * - * @since 1.4 - */ + * @since 1.4 + */ public boolean isConnected() { - return remoteAddress != null; - } + return remoteAddress != null; + } - /** - * Returns the SocketAddress of the host this socket is conneted to - * or null if this socket is not connected. - * + /** + * Returns the SocketAddress of the host this socket is conneted to + * or null if this socket is not connected. + * * @return The socket address of the remote host if connected or null * - * @since 1.4 - */ + * @since 1.4 + */ public SocketAddress getRemoteSocketAddress() { if (! isConnected()) - return null; + return null; - return new InetSocketAddress(remoteAddress, remotePort); - } + return new InetSocketAddress(remoteAddress, remotePort); + } - /** + /** * Returns the local SocketAddress this socket is bound to. * * @return The local SocketAddress or null if the socket is not bound. - * - * @since 1.4 - */ + * + * @since 1.4 + */ public SocketAddress getLocalSocketAddress() { if (! isBound()) - return null; + return null; return new InetSocketAddress(getLocalAddress(), getLocalPort()); - } + } - /** - * Enables/Disables SO_REUSEADDR. - * - * @param on Whether or not to have SO_REUSEADDR turned on. - * - * @exception SocketException If an error occurs. - * - * @since 1.4 - */ + /** + * Enables/Disables SO_REUSEADDR. + * + * @param on Whether or not to have SO_REUSEADDR turned on. + * + * @exception SocketException If an error occurs. + * + * @since 1.4 + */ public void setReuseAddress(boolean on) throws SocketException { if (isClosed()) throw new SocketException("socket is closed"); getImpl().setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(on)); - } + } - /** - * Checks if SO_REUSEADDR is enabled. - * + /** + * Checks if SO_REUSEADDR is enabled. + * * @return True if SO_REUSEADDR is set on the socket, false otherwise. * - * @exception SocketException If an error occurs. - * - * @since 1.4 - */ + * @exception SocketException If an error occurs. + * + * @since 1.4 + */ public boolean getReuseAddress() throws SocketException { if (isClosed()) @@ -834,34 +855,34 @@ return ((Boolean) buf).booleanValue(); throw new SocketException("unexpected type"); - } + } - /** - * Enables/Disables SO_BROADCAST - * + /** + * Enables/Disables SO_BROADCAST + * * @param enable True if SO_BROADCAST should be enabled, false otherwise. - * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ + * + * @exception SocketException If an error occurs + * + * @since 1.4 + */ public void setBroadcast(boolean enable) throws SocketException { if (isClosed()) throw new SocketException("socket is closed"); getImpl().setOption(SocketOptions.SO_BROADCAST, Boolean.valueOf(enable)); - } + } - /** - * Checks if SO_BROADCAST is enabled - * + /** + * Checks if SO_BROADCAST is enabled + * * @return Whether SO_BROADCAST is set * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ + * @exception SocketException If an error occurs + * + * @since 1.4 + */ public boolean getBroadcast() throws SocketException { if (isClosed()) @@ -873,42 +894,42 @@ return ((Boolean) buf).booleanValue(); throw new SocketException("unexpected type"); - } + } - /** - * Sets the traffic class value - * - * @param tc The traffic class - * - * @exception SocketException If an error occurs - * @exception IllegalArgumentException If tc value is illegal - * + /** + * Sets the traffic class value + * + * @param tc The traffic class + * + * @exception SocketException If an error occurs + * @exception IllegalArgumentException If tc value is illegal + * * @see DatagramSocket#getTrafficClass() - * - * @since 1.4 - */ + * + * @since 1.4 + */ public void setTrafficClass(int tc) throws SocketException { if (isClosed()) throw new SocketException("socket is closed"); - if (tc < 0 || tc > 255) - throw new IllegalArgumentException(); + if (tc < 0 || tc > 255) + throw new IllegalArgumentException(); getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc)); - } + } - /** - * Returns the current traffic class - * + /** + * Returns the current traffic class + * * @return The current traffic class. * * @see DatagramSocket#setTrafficClass(int tc) - * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ + * + * @exception SocketException If an error occurs + * + * @since 1.4 + */ public int getTrafficClass() throws SocketException { if (isClosed()) @@ -920,28 +941,28 @@ return ((Integer) buf).intValue(); throw new SocketException("unexpected type"); - } + } - /** - * Sets the datagram socket implementation factory for the application - * - * @param fac The factory to set - * - * @exception IOException If an error occurs - * @exception SocketException If the factory is already defined - * @exception SecurityException If a security manager exists and its - * checkSetFactory method doesn't allow the operation - */ - public static void setDatagramSocketImplFactory(DatagramSocketImplFactory fac) + /** + * Sets the datagram socket implementation factory for the application + * + * @param fac The factory to set + * + * @exception IOException If an error occurs + * @exception SocketException If the factory is already defined + * @exception SecurityException If a security manager exists and its + * checkSetFactory method doesn't allow the operation + */ + public static void setDatagramSocketImplFactory(DatagramSocketImplFactory fac) throws IOException { - if (factory != null) - throw new SocketException("DatagramSocketImplFactory already defined"); + if (factory != null) + throw new SocketException("DatagramSocketImplFactory already defined"); - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkSetFactory(); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkSetFactory(); - factory = fac; - } + factory = fac; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2006-12-14 12:58:39
|
Revision: 2926 http://jnode.svn.sourceforge.net/jnode/?rev=2926&view=rev Author: hagar-wize Date: 2006-12-14 04:58:38 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Classpath patches Modified Paths: -------------- trunk/core/src/classpath/gnu/gnu/java/nio/SocketChannelImpl.java Modified: trunk/core/src/classpath/gnu/gnu/java/nio/SocketChannelImpl.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/nio/SocketChannelImpl.java 2006-12-14 12:57:50 UTC (rev 2925) +++ trunk/core/src/classpath/gnu/gnu/java/nio/SocketChannelImpl.java 2006-12-14 12:58:38 UTC (rev 2926) @@ -39,15 +39,20 @@ package gnu.java.nio; import gnu.java.net.PlainSocketImpl; +import gnu.java.net.VMPlainSocketImpl; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; +import java.net.SocketException; import java.net.SocketTimeoutException; import java.nio.ByteBuffer; +import java.nio.ReadOnlyBufferException; import java.nio.channels.AlreadyConnectedException; import java.nio.channels.ClosedChannelException; import java.nio.channels.ConnectionPendingException; @@ -61,33 +66,62 @@ import java.nio.channels.spi.SelectorProvider; public final class SocketChannelImpl extends SocketChannel + implements VMChannelOwner { - private PlainSocketImpl impl; + private VMChannel channel; + //private PlainSocketImpl impl; private NIOSocket socket; private boolean connectionPending; + private boolean connected; + private InetSocketAddress connectAddress; + + public SocketChannelImpl(boolean create) throws IOException + { + // XXX consider adding security check; this is used by + // PlainSocketImpl. + this(new SelectorProviderImpl(), create); + } - SocketChannelImpl (SelectorProvider provider) + public SocketChannelImpl(VMChannel channel) throws IOException + { + this(new SelectorProviderImpl(), channel, false); + } + + SocketChannelImpl(SelectorProvider provider) throws IOException + { + this(provider, true); + } + + SocketChannelImpl(SelectorProvider provider, boolean create) throws IOException { + this(provider, new VMChannel(), create); + } + + SocketChannelImpl(SelectorProvider provider, VMChannel channel, boolean create) + throws IOException + { super (provider); - impl = new PlainSocketImpl(); - socket = new NIOSocket (impl, this); + this.channel = channel; + if (create) + channel.initSocket(true); + socket = new NIOSocket(this); configureBlocking(true); } - - SocketChannelImpl (SelectorProvider provider, + + /*SocketChannelImpl (SelectorProvider provider, NIOSocket socket) throws IOException - { + { super (provider); this.impl = socket.getPlainSocketImpl(); this.socket = socket; - } - + }*/ + public void finalizer() { if (isConnected()) - { + { try { close (); @@ -95,117 +129,95 @@ catch (Exception e) { } - } + } } - PlainSocketImpl getPlainSocketImpl() - { - return impl; - } + //PlainSocketImpl getPlainSocketImpl() + //{ + // return null; // XXX + //} - protected void implCloseSelectableChannel () throws IOException + protected void implCloseSelectableChannel() throws IOException { - socket.close(); + channel.close(); } protected void implConfigureBlocking (boolean blocking) throws IOException - { - socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); - } + { + channel.setBlocking(blocking); + } public boolean connect (SocketAddress remote) throws IOException { + return connect(remote, 0); + } + + public boolean connect (SocketAddress remote, int timeout) throws IOException + { if (!isOpen()) throw new ClosedChannelException(); if (isConnected()) throw new AlreadyConnectedException(); - + if (connectionPending) throw new ConnectionPendingException(); - + if (!(remote instanceof InetSocketAddress)) throw new UnsupportedAddressTypeException(); - - if (((InetSocketAddress) remote).isUnresolved()) - throw new UnresolvedAddressException(); - try - { - socket.getPlainSocketImpl().setInChannelOperation(true); - // indicate that a channel is initiating the accept operation - // so that the socket ignores the fact that we might be in - // non-blocking mode. + connectAddress = (InetSocketAddress) remote; - if (isBlocking()) - { - // Do blocking connect. - socket.connect (remote); - return true; - } + if (connectAddress.isUnresolved()) + throw new UnresolvedAddressException(); - // Do non-blocking connect. - try - { - socket.connect (remote, NIOConstants.DEFAULT_TIMEOUT); - return true; - } - catch (SocketTimeoutException e) - { - connectionPending = true; - return false; + connected = channel.connect(connectAddress, timeout); + connectionPending = !connected; + return connected; } - } - finally - { - socket.getPlainSocketImpl().setInChannelOperation(false); - } - } - public boolean finishConnect () + public boolean finishConnect() throws IOException { if (!isOpen()) throw new ClosedChannelException(); - - if (!isConnected() && !connectionPending) - throw new NoConnectionPendingException(); - - if (isConnected()) - return true; - // FIXME: Handle blocking/non-blocking mode. - - Selector selector = provider().openSelector(); - register(selector, SelectionKey.OP_CONNECT); - - if (isBlocking()) + InetSocketAddress remote = channel.getPeerAddress(); + if (remote != null) { - selector.select(); // blocking until channel is connected. connectionPending = false; return true; - } - - int ready = selector.selectNow(); // non-blocking - if (ready == 1) - { - connectionPending = false; - return true; } - + + if (!connectionPending) + throw new NoConnectionPendingException(); + return false; } - - public boolean isConnected () + + public boolean isConnected() { - return socket.isConnected(); + // Wait until finishConnect is called before transitioning to + // connected. + if (connectionPending) + return false; + try + { + InetSocketAddress remote = channel.getPeerAddress(); + return remote != null; + } + catch (IOException ioe) + { + ioe.printStackTrace(System.out); + return false; + } } public boolean isConnectionPending () - { + { return connectionPending; - } - + } + public Socket socket () { return socket; @@ -215,55 +227,10 @@ { if (!isConnected()) throw new NotYetConnectedException(); - - byte[] data; - int offset = 0; - InputStream input = socket.getInputStream(); - int available = input.available(); - int len = dst.remaining(); - - if ((! isBlocking()) && available == 0) - return 0; - if (dst.hasArray()) - { - offset = dst.arrayOffset() + dst.position(); - data = dst.array(); - } - else - { - data = new byte [len]; + return channel.read(dst); } - int readBytes = 0; - boolean completed = false; - - try - { - begin(); - socket.getPlainSocketImpl().setInChannelOperation(true); - readBytes = input.read (data, offset, len); - completed = true; - } - finally - { - end (completed); - socket.getPlainSocketImpl().setInChannelOperation(false); - } - - if (readBytes > 0) - if (dst.hasArray()) - { - dst.position (dst.position() + readBytes); - } - else - { - dst.put (data, offset, readBytes); - } - - return readBytes; - } - public long read (ByteBuffer[] dsts, int offset, int length) throws IOException { @@ -275,61 +242,19 @@ || (length < 0) || (length > (dsts.length - offset))) throw new IndexOutOfBoundsException(); - - long readBytes = 0; - - for (int index = offset; index < length; index++) - readBytes += read (dsts [index]); - - return readBytes; + + return channel.readScattering(dsts, offset, length); } - public int write (ByteBuffer src) - throws IOException + public int write(ByteBuffer src) throws IOException { if (!isConnected()) throw new NotYetConnectedException(); - byte[] data; - int offset = 0; - int len = src.remaining(); - - if (!src.hasArray()) - { - data = new byte [len]; - src.get (data, 0, len); - } - else - { - offset = src.arrayOffset() + src.position(); - data = src.array(); - } - - OutputStream output = socket.getOutputStream(); - boolean completed = false; - - try - { - begin(); - socket.getPlainSocketImpl().setInChannelOperation(true); - output.write (data, offset, len); - completed = true; - } - finally - { - end (completed); - socket.getPlainSocketImpl().setInChannelOperation(false); - } - - if (src.hasArray()) - { - src.position (src.position() + len); - } - - return len; + return channel.write(src); } - public long write (ByteBuffer[] srcs, int offset, int length) + public long write(ByteBuffer[] srcs, int offset, int length) throws IOException { if (!isConnected()) @@ -340,12 +265,13 @@ || (length < 0) || (length > (srcs.length - offset))) throw new IndexOutOfBoundsException(); - - long writtenBytes = 0; - for (int index = offset; index < length; index++) - writtenBytes += write (srcs [index]); - - return writtenBytes; + return channel.writeGathering(srcs, offset, length); } + + public VMChannel getVMChannel() + { + // XXX security check? + return channel; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2006-12-14 12:57:51
|
Revision: 2925 http://jnode.svn.sourceforge.net/jnode/?rev=2925&view=rev Author: hagar-wize Date: 2006-12-14 04:57:50 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Classpath patches Modified Paths: -------------- trunk/core/src/classpath/java/java/io/FileOutputStream.java trunk/core/src/classpath/java/java/io/RandomAccessFile.java Modified: trunk/core/src/classpath/java/java/io/FileOutputStream.java =================================================================== --- trunk/core/src/classpath/java/java/io/FileOutputStream.java 2006-12-14 12:57:01 UTC (rev 2924) +++ trunk/core/src/classpath/java/java/io/FileOutputStream.java 2006-12-14 12:57:50 UTC (rev 2925) @@ -38,8 +38,9 @@ package java.io; -import gnu.java.nio.channels.FileChannelImpl; +import gnu.java.nio.FileChannelImpl; +import java.nio.ByteBuffer; import java.nio.channels.FileChannel; /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 @@ -155,11 +156,24 @@ if (s != null) s.checkWrite(file.getPath()); + try + { ch = FileChannelImpl.create(file, (append ? FileChannelImpl.WRITE | FileChannelImpl.APPEND : FileChannelImpl.WRITE)); } + catch (FileNotFoundException fnfe) + { + throw fnfe; + } + catch (IOException ioe) + { + FileNotFoundException fnfe = new FileNotFoundException(file.getPath()); + fnfe.initCause(ioe); + throw fnfe; + } + } /** * This method initializes a <code>FileOutputStream</code> object to write @@ -266,7 +280,7 @@ || offset + len > buf.length) throw new ArrayIndexOutOfBoundsException (); - ch.write (buf, offset, len); + ch.write(ByteBuffer.wrap(buf, offset, len)); } /** Modified: trunk/core/src/classpath/java/java/io/RandomAccessFile.java =================================================================== --- trunk/core/src/classpath/java/java/io/RandomAccessFile.java 2006-12-14 12:57:01 UTC (rev 2924) +++ trunk/core/src/classpath/java/java/io/RandomAccessFile.java 2006-12-14 12:57:50 UTC (rev 2925) @@ -38,7 +38,7 @@ package java.io; -import gnu.java.nio.channels.FileChannelImpl; +import gnu.java.nio.FileChannelImpl; import java.nio.channels.FileChannel; @@ -122,7 +122,20 @@ s.checkWrite(fileName); } + try + { ch = FileChannelImpl.create(file, fdmode); + } + catch (FileNotFoundException fnfe) + { + throw fnfe; + } + catch (IOException ioe) + { + FileNotFoundException fnfe = new FileNotFoundException(file.getPath()); + fnfe.initCause(ioe); + throw fnfe; + } fd = new FileDescriptor(ch); if ((fdmode & FileChannelImpl.WRITE) != 0) out = new DataOutputStream (new FileOutputStream (fd)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2006-12-14 12:57:04
|
Revision: 2924 http://jnode.svn.sourceforge.net/jnode/?rev=2924&view=rev Author: hagar-wize Date: 2006-12-14 04:57:01 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Classpath patches Added Paths: ----------- trunk/core/src/classpath/vm/gnu/java/net/VMPlainSocketImpl.java Copied: trunk/core/src/classpath/vm/gnu/java/net/VMPlainSocketImpl.java (from rev 2916, trunk/core/src/classpath/vm/java/net/VMPlainSocketImpl.java) =================================================================== --- trunk/core/src/classpath/vm/gnu/java/net/VMPlainSocketImpl.java (rev 0) +++ trunk/core/src/classpath/vm/gnu/java/net/VMPlainSocketImpl.java 2006-12-14 12:57:01 UTC (rev 2924) @@ -0,0 +1,512 @@ +/* VMPlainSocketImpl.java -- VM interface for default socket implementation + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.net; + +import java.io.IOException; +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.SocketOptions; + +import gnu.classpath.Configuration; +import gnu.java.nio.VMChannel; + +/** + * The VM interface for {@link gnu.java.net.PlainSocketImpl}. + * + * @author Ingo Proetel (pr...@ai...) + * @author Roman Kennke (ke...@ai...) + */ +public final class VMPlainSocketImpl +{ + /** Option id for time to live + */ + private static final int CP_IP_TTL = 0x1E61; + + private final State nfd; + + /** + * Static initializer to load native library. + */ + static + { + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("javanet"); + } + } + + public VMPlainSocketImpl() + { + // XXX consider adding security check here. + nfd = new State(); + } + + public VMPlainSocketImpl(VMChannel channel) throws IOException + { + this(); + nfd.setChannelFD(channel.getState()); + } + + public State getState() + { + return nfd; + } + + /** This method exists to hide the CP_IP_TTL value from + * higher levels. + * + * Always think of JNode ... :) + */ + public void setTimeToLive(int ttl) + throws SocketException + { + try + { + setOption(nfd.getNativeFD(), CP_IP_TTL, ttl); + } + catch (IOException ioe) + { + SocketException se = new SocketException(); + se.initCause(ioe); + throw se; + } + } + + public int getTimeToLive() + throws SocketException + { + try + { + return getOption(nfd.getNativeFD(), CP_IP_TTL); + } + catch (IOException ioe) + { + SocketException se = new SocketException(); + se.initCause(ioe); + throw se; + } + } + + public void setOption(int optionId, Object optionValue) + throws SocketException + { + int value; + if (optionValue instanceof Integer) + value = ((Integer) optionValue).intValue(); + else if (optionValue instanceof Boolean) + // Switching off the linger behavior is done by setting + // the value to -1. This is how the Java API interprets + // it. + value = ((Boolean) optionValue).booleanValue() + ? 1 + : (optionId == SocketOptions.SO_LINGER) + ? -1 + : 0; + else + throw new IllegalArgumentException("option value type " + + optionValue.getClass().getName()); + + try + { + setOption(nfd.getNativeFD(), optionId, value); + } + catch (IOException ioe) + { + SocketException se = new SocketException(); + se.initCause(ioe); + throw se; + } + } + + private static native void setOption(int fd, int id, int value) + throws SocketException; + + public void setMulticastInterface(int optionId, InetAddress addr) + throws SocketException + { + try + { + if (addr instanceof Inet4Address) + setMulticastInterface(nfd.getNativeFD(), optionId, (Inet4Address) addr); + else if (addr instanceof Inet6Address) + { + NetworkInterface iface = NetworkInterface.getByInetAddress(addr); + setMulticastInterface6(nfd.getNativeFD(), optionId, iface.getName()); + } + else + throw new SocketException("Unknown address format: " + addr); + } + catch (SocketException se) + { + throw se; + } + catch (IOException ioe) + { + SocketException se = new SocketException(); + se.initCause(ioe); + throw se; + } + } + + private static native void setMulticastInterface(int fd, + int optionId, + Inet4Address addr); + + private static native void setMulticastInterface6(int fd, + int optionId, + String ifName); + + /** + * Get a socket option. This implementation is only required to support + * socket options that are boolean values, which include: + * + * SocketOptions.IP_MULTICAST_LOOP + * SocketOptions.SO_BROADCAST + * SocketOptions.SO_KEEPALIVE + * SocketOptions.SO_OOBINLINE + * SocketOptions.SO_REUSEADDR + * SocketOptions.TCP_NODELAY + * + * and socket options that are integer values, which include: + * + * SocketOptions.IP_TOS + * SocketOptions.SO_LINGER + * SocketOptions.SO_RCVBUF + * SocketOptions.SO_SNDBUF + * SocketOptions.SO_TIMEOUT + * + * @param optionId The option ID to fetch. + * @return A {@link Boolean} or {@link Integer} containing the socket + * option. + * @throws SocketException + */ + public Object getOption(int optionId) throws SocketException + { + int value; + try + { + value = getOption(nfd.getNativeFD(), optionId); + } + catch (IOException ioe) + { + SocketException se = new SocketException(); + se.initCause(ioe); + throw se; + } + + switch (optionId) + { + case SocketOptions.IP_MULTICAST_LOOP: + case SocketOptions.SO_BROADCAST: + case SocketOptions.SO_KEEPALIVE: + case SocketOptions.SO_OOBINLINE: + case SocketOptions.SO_REUSEADDR: + case SocketOptions.TCP_NODELAY: + return Boolean.valueOf(value != 0); + + case SocketOptions.IP_TOS: + case SocketOptions.SO_LINGER: + case SocketOptions.SO_RCVBUF: + case SocketOptions.SO_SNDBUF: + case SocketOptions.SO_TIMEOUT: + return new Integer(value); + + default: + throw new SocketException("getting option " + optionId + + " not supported here"); + } + } + + private static native int getOption(int fd, int id) throws SocketException; + + /** + * Returns an Inet4Address or Inet6Address instance belonging to the + * interface which is set as the multicast interface. + * + * The optionId is provided to make it possible that the native + * implementation may do something different depending on whether + * the value is SocketOptions.IP_MULTICAST_IF or + * SocketOptions.IP_MULTICAST_IF2. + */ + public InetAddress getMulticastInterface(int optionId) + throws SocketException + { + try + { + return getMulticastInterface(nfd.getNativeFD(), optionId); + } + catch (IOException ioe) + { + SocketException se = new SocketException(); + se.initCause(ioe); + throw se; + } + } + + private static native InetAddress getMulticastInterface(int fd, + int optionId); + + /** + * Binds this socket to the given local address and port. + * + * @param address The address to bind to; the InetAddress is either + * an IPv4 or IPv6 address. + * @throws IOException If binding fails; for example, if the port + * in the given InetSocketAddress is privileged, and the current + * process has insufficient privileges. + */ + public void bind(InetSocketAddress address) throws IOException + { + InetAddress addr = address.getAddress(); + if (addr instanceof Inet4Address) + { + bind (nfd.getNativeFD(), addr.getAddress(), address.getPort()); + } + else if (addr instanceof Inet6Address) + bind6 (nfd.getNativeFD(), addr.getAddress(), address.getPort()); + else + throw new SocketException ("unsupported address type"); + } + + /** + * Native bind function for IPv4 addresses. The addr array must be + * exactly four bytes long. + * + * VMs without native support need not implement this. + * + * @param fd The native file descriptor integer. + * @param addr The IPv4 address, in network byte order. + * @param port The port to bind to. + * @throws IOException + */ + private static native void bind(int fd, byte[] addr, int port) + throws IOException; + + /** + * Native bind function for IPv6 addresses. The addr array must be + * exactly sixteen bytes long. + * + * VMs without native support need not implement this. + * + * @param fd The native file descriptor integer. + * @param addr The IPv6 address, in network byte order. + * @param port The port to bind to. + * @throws IOException + */ + private static native void bind6(int fd, byte[] addr, int port) + throws IOException; + + /** + * Listen on this socket for incoming connections. + * + * @param backlog The backlog of connections. + * @throws IOException If listening fails. + * @see gnu.java.nio.VMChannel#accept() + */ + public void listen(int backlog) throws IOException + { + listen(nfd.getNativeFD(), backlog); + } + + /** + * Native listen function. VMs without native support need not implement + * this. + * + * @param fd The file descriptor integer. + * @param backlog The listen backlog size. + * @throws IOException + */ + private static native void listen(int fd, int backlog) throws IOException; + + public void join(InetAddress group) throws IOException + { + if (group instanceof Inet4Address) + join(nfd.getNativeFD(), group.getAddress()); + else if (group instanceof Inet6Address) + join6(nfd.getNativeFD(), group.getAddress()); + else + throw new IllegalArgumentException("unknown address type"); + } + + private static native void join(int fd, byte[] addr) throws IOException; + + private static native void join6(int fd, byte[] addr) throws IOException; + + public void leave(InetAddress group) throws IOException + { + if (group instanceof Inet4Address) + leave(nfd.getNativeFD(), group.getAddress()); + else if (group instanceof Inet6Address) + leave6(nfd.getNativeFD(), group.getAddress()); + else + throw new IllegalArgumentException("unknown address type"); + } + + private static native void leave(int fd, byte[] addr) throws IOException; + + private static native void leave6(int fd, byte[] addr) throws IOException; + + public void joinGroup(InetSocketAddress addr, NetworkInterface netif) + throws IOException + { + InetAddress address = addr.getAddress(); + + if (address instanceof Inet4Address) + joinGroup(nfd.getNativeFD(), address.getAddress(), + netif != null ? netif.getName() : null); + else if (address instanceof Inet6Address) + joinGroup6(nfd.getNativeFD(), address.getAddress(), + netif != null ? netif.getName() : null); + else + throw new IllegalArgumentException("unknown address type"); + } + + private static native void joinGroup(int fd, byte[] addr, String ifname) + throws IOException; + + private static native void joinGroup6(int fd, byte[] addr, String ifname) + throws IOException; + + public void leaveGroup(InetSocketAddress addr, NetworkInterface netif) + throws IOException + { + InetAddress address = addr.getAddress(); + if (address instanceof Inet4Address) + leaveGroup(nfd.getNativeFD(), address.getAddress(), + netif != null ? netif.getName() : null); + else if (address instanceof Inet6Address) + leaveGroup6(nfd.getNativeFD(), address.getAddress(), + netif != null ? netif.getName() : null); + else + throw new IllegalArgumentException("unknown address type"); + } + + private static native void leaveGroup(int fd, byte[] addr, String ifname) + throws IOException; + + private static native void leaveGroup6(int fd, byte[] addr, String ifname) + throws IOException; + + + public void shutdownInput() throws IOException + { + shutdownInput(nfd.getNativeFD()); + } + + private static native void shutdownInput(int native_fd) throws IOException; + + public void shutdownOutput() throws IOException + { + shutdownOutput(nfd.getNativeFD()); + } + + private static native void shutdownOutput(int native_fd) throws IOException; + + public void sendUrgentData(int data) throws IOException + { + sendUrgentData(nfd.getNativeFD(), data); + } + + private static native void sendUrgentData(int natfive_fd, int data) throws IOException; + + public void close() throws IOException + { + nfd.close(); + } + + // Inner classes. + + /** + * Our wrapper for the native file descriptor. In this implementation, + * it is a simple wrapper around {@link VMChannel.State}, to simplify + * management of the native state. + */ + public final class State + { + private VMChannel.State channelFd; + + State() + { + channelFd = null; + } + + public boolean isValid() + { + if (channelFd != null) + return channelFd.isValid(); + return false; + } + + public int getNativeFD() throws IOException + { + return channelFd.getNativeFD(); + } + + public void setChannelFD(final VMChannel.State nfd) throws IOException + { + if (this.channelFd != null && this.channelFd.isValid()) + throw new IOException("file descriptor already initialized"); + this.channelFd = nfd; + } + + public void close() throws IOException + { + if (channelFd == null) + throw new IOException("invalid file descriptor"); + channelFd.close(); + } + + protected void finalize() throws Throwable + { + try + { + if (isValid()) + close(); + } + finally + { + super.finalize(); + } + } + } +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2006-12-14 12:56:30
|
Revision: 2923 http://jnode.svn.sourceforge.net/jnode/?rev=2923&view=rev Author: hagar-wize Date: 2006-12-14 04:56:28 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Classpath patches Added Paths: ----------- trunk/core/src/classpath/vm/gnu/java/net/ trunk/core/src/classpath/vm/gnu/java/net/VMPlainDatagramSocketImpl.java Copied: trunk/core/src/classpath/vm/gnu/java/net/VMPlainDatagramSocketImpl.java (from rev 2916, trunk/core/src/classpath/vm/java/net/VMPlainDatagramSocketImpl.java) =================================================================== --- trunk/core/src/classpath/vm/gnu/java/net/VMPlainDatagramSocketImpl.java (rev 0) +++ trunk/core/src/classpath/vm/gnu/java/net/VMPlainDatagramSocketImpl.java 2006-12-14 12:56:28 UTC (rev 2923) @@ -0,0 +1,260 @@ +/* PlainDatagramSocketImpl.java -- VM interface for DatagramSocket impl + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.java.net; + +import gnu.classpath.Configuration; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketAddress; +import java.net.SocketException; + +/** + * The VM interface for {@link gnu.java.net.PlainDatagramSocketImpl}. + * + * @author Ingo Proetel (pr...@ai...) + * @author Roman Kennke (ke...@ai...) + */ +public final class VMPlainDatagramSocketImpl +{ + /** + * Option id for the IP_TTL (time to live) value. + */ + static final int IP_TTL = 0x1E61; // 7777 + + + // Static initializer to load native library + static + { + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("javanet"); + } + } + + /** + * Binds this socket to a particular port and interface + * + * @param socket the socket object + * @param port the port to bind to + * @param addr the address to bind to + * + * @throws SocketException If an error occurs + */ + static native void bind(PlainDatagramSocketImpl socket, int port, + InetAddress addr) + throws SocketException; + + /** + * Creates a new datagram socket. + * + * @param socket the socket object + * + * @throws SocketException If an error occurs + */ + static native void create(PlainDatagramSocketImpl socket) + throws SocketException; + + /** + * Connects to the remote address and port specified as arguments. + * + * @param socket the socket object + * @param addr the remote address to connect to + * @param port the remote port to connect to + * + * @throws SocketException If an error occurs + */ + static native void connect(PlainDatagramSocketImpl socket, InetAddress addr, + int port) + throws SocketException; + + /** + * Sends a packet of data to a remote host. + * + * @param socket the socket object + * @param packet the packet to send + * + * @throws IOException If an error occurs + */ + static void send(PlainDatagramSocketImpl socket, DatagramPacket packet) + throws IOException + { + nativeSendTo(socket, packet.getAddress(), packet.getPort(), + packet.getData(), packet.getOffset(), packet.getLength()); + } + + + /** + * Sends a packet of data to a remote host. + * + * @param socket the socket object + * @param addr the address to send to + * @param port the port to send to + * @param buf the buffer to send + * @param offset the offset of the data in the buffer to send + * @param len the length of the data to send + * + * @throws IOException If an error occurs + */ + private static native void nativeSendTo(PlainDatagramSocketImpl socket, + InetAddress addr, int port, + byte[] buf, int offset, int len) + throws IOException; + + /** + * Receives a UDP packet from the network + * + * @param socket the socket object + * @param packet the packet to fill in with the data received + * + * @throws IOException IOException If an error occurs + */ + static void receive(PlainDatagramSocketImpl socket, DatagramPacket packet) + throws IOException + { + byte[] receiveFromAddress = new byte[4]; + int[] receiveFromPort = new int[1]; + int[] receivedLength = new int[1]; + + nativeReceive(socket, packet.getData(), packet.getOffset(), + packet.getLength(), + receiveFromAddress, receiveFromPort, receivedLength); + + packet.setAddress(InetAddress.getByAddress(receiveFromAddress)); + packet.setPort(receiveFromPort[0]); + packet.setLength(receivedLength[0]); + } + + private static native void nativeReceive(PlainDatagramSocketImpl socket, + byte[] buf, int offset, int len, + byte[] receiveFromAddress, + int[] receiveFromPort, + int[] receivedLength) + throws IOException; + + /** + * Sets the value of an option on the socket + * + * @param socket the socket object + * @param optionId the identifier of the option to set + * @param value the value of the option to set + * + * @exception SocketException If an error occurs + */ + static native void setOption(PlainDatagramSocketImpl socket, int optionId, + Object value) + throws SocketException; + + /** + * Retrieves the value of an option on the socket. + * + * @param socket the socket object + * @param optionId the identifier of the option to retrieve + * + * @return the value of the option + * + * @throws SocketException if an error occurs + */ + static native Object getOption(PlainDatagramSocketImpl socket, int optionId) + throws SocketException; + + /** + * Closes the socket. + * + * @param socket the socket object + */ + static native void close(PlainDatagramSocketImpl socket); + + /** + * Joins a multicast group + * + * @param addr The group to join + * + * @exception IOException If an error occurs + */ + static native void join(PlainDatagramSocketImpl socket, InetAddress addr) + throws IOException; + + /** + * Leaves a multicast group + * + * @param addr The group to leave + * + * @exception IOException If an error occurs + */ + static native void leave(PlainDatagramSocketImpl socket, InetAddress addr) + throws IOException; + + /** + * Joins a multicast group. + * + * @param socket the socket object + * @param address the socket address + * @param netIf the network interface + * + * @throws IOException if I/O errors occur + */ + static void joinGroup(PlainDatagramSocketImpl socket, SocketAddress address, + NetworkInterface netIf) + throws IOException + { + throw new InternalError + ("PlainDatagramSocketImpl::joinGroup is not implemented"); + } + + /** + * Leaves a multicast group. + * + * @param socket the socket object + * @param address the socket address + * @param netIf the network interface + * + * @throws IOException if I/O errors occur + */ + static void leaveGroup(PlainDatagramSocketImpl socket, SocketAddress address, + NetworkInterface netIf) + throws IOException + { + throw new InternalError + ("PlainDatagramSocketImpl::leaveGroup is not implemented"); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2006-12-14 10:44:24
|
Revision: 2922 http://jnode.svn.sourceforge.net/jnode/?rev=2922&view=rev Author: hagar-wize Date: 2006-12-14 02:44:22 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Classpath patches Removed Paths: ------------- trunk/core/src/classpath/vm/java/net/VMPlainDatagramSocketImpl.java trunk/core/src/classpath/vm/java/net/VMPlainSocketImpl.java Deleted: trunk/core/src/classpath/vm/java/net/VMPlainDatagramSocketImpl.java =================================================================== --- trunk/core/src/classpath/vm/java/net/VMPlainDatagramSocketImpl.java 2006-12-14 10:25:05 UTC (rev 2921) +++ trunk/core/src/classpath/vm/java/net/VMPlainDatagramSocketImpl.java 2006-12-14 10:44:22 UTC (rev 2922) @@ -1,260 +0,0 @@ -/* PlainDatagramSocketImpl.java -- VM interface for DatagramSocket impl - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.net; - -import gnu.classpath.Configuration; - -import java.io.IOException; -import java.net.DatagramPacket; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketAddress; -import java.net.SocketException; - -/** - * The VM interface for {@link gnu.java.net.PlainDatagramSocketImpl}. - * - * @author Ingo Proetel (pr...@ai...) - * @author Roman Kennke (ke...@ai...) - */ -public final class VMPlainDatagramSocketImpl -{ - /** - * Option id for the IP_TTL (time to live) value. - */ - static final int IP_TTL = 0x1E61; // 7777 - - - // Static initializer to load native library - static - { - if (Configuration.INIT_LOAD_LIBRARY) - { - System.loadLibrary("javanet"); - } - } - - /** - * Binds this socket to a particular port and interface - * - * @param socket the socket object - * @param port the port to bind to - * @param addr the address to bind to - * - * @throws SocketException If an error occurs - */ - static native void bind(PlainDatagramSocketImpl socket, int port, - InetAddress addr) - throws SocketException; - - /** - * Creates a new datagram socket. - * - * @param socket the socket object - * - * @throws SocketException If an error occurs - */ - static native void create(PlainDatagramSocketImpl socket) - throws SocketException; - - /** - * Connects to the remote address and port specified as arguments. - * - * @param socket the socket object - * @param addr the remote address to connect to - * @param port the remote port to connect to - * - * @throws SocketException If an error occurs - */ - static native void connect(PlainDatagramSocketImpl socket, InetAddress addr, - int port) - throws SocketException; - - /** - * Sends a packet of data to a remote host. - * - * @param socket the socket object - * @param packet the packet to send - * - * @throws IOException If an error occurs - */ - static void send(PlainDatagramSocketImpl socket, DatagramPacket packet) - throws IOException - { - nativeSendTo(socket, packet.getAddress(), packet.getPort(), - packet.getData(), packet.getOffset(), packet.getLength()); - } - - - /** - * Sends a packet of data to a remote host. - * - * @param socket the socket object - * @param addr the address to send to - * @param port the port to send to - * @param buf the buffer to send - * @param offset the offset of the data in the buffer to send - * @param len the length of the data to send - * - * @throws IOException If an error occurs - */ - private static native void nativeSendTo(PlainDatagramSocketImpl socket, - InetAddress addr, int port, - byte[] buf, int offset, int len) - throws IOException; - - /** - * Receives a UDP packet from the network - * - * @param socket the socket object - * @param packet the packet to fill in with the data received - * - * @throws IOException IOException If an error occurs - */ - static void receive(PlainDatagramSocketImpl socket, DatagramPacket packet) - throws IOException - { - byte[] receiveFromAddress = new byte[4]; - int[] receiveFromPort = new int[1]; - int[] receivedLength = new int[1]; - - nativeReceive(socket, packet.getData(), packet.getOffset(), - packet.getLength(), - receiveFromAddress, receiveFromPort, receivedLength); - - packet.setAddress(InetAddress.getByAddress(receiveFromAddress)); - packet.setPort(receiveFromPort[0]); - packet.setLength(receivedLength[0]); - } - - private static native void nativeReceive(PlainDatagramSocketImpl socket, - byte[] buf, int offset, int len, - byte[] receiveFromAddress, - int[] receiveFromPort, - int[] receivedLength) - throws IOException; - - /** - * Sets the value of an option on the socket - * - * @param socket the socket object - * @param optionId the identifier of the option to set - * @param value the value of the option to set - * - * @exception SocketException If an error occurs - */ - static native void setOption(PlainDatagramSocketImpl socket, int optionId, - Object value) - throws SocketException; - - /** - * Retrieves the value of an option on the socket. - * - * @param socket the socket object - * @param optionId the identifier of the option to retrieve - * - * @return the value of the option - * - * @throws SocketException if an error occurs - */ - static native Object getOption(PlainDatagramSocketImpl socket, int optionId) - throws SocketException; - - /** - * Closes the socket. - * - * @param socket the socket object - */ - static native void close(PlainDatagramSocketImpl socket); - - /** - * Joins a multicast group - * - * @param addr The group to join - * - * @exception IOException If an error occurs - */ - static native void join(PlainDatagramSocketImpl socket, InetAddress addr) - throws IOException; - - /** - * Leaves a multicast group - * - * @param addr The group to leave - * - * @exception IOException If an error occurs - */ - static native void leave(PlainDatagramSocketImpl socket, InetAddress addr) - throws IOException; - - /** - * Joins a multicast group. - * - * @param socket the socket object - * @param address the socket address - * @param netIf the network interface - * - * @throws IOException if I/O errors occur - */ - static void joinGroup(PlainDatagramSocketImpl socket, SocketAddress address, - NetworkInterface netIf) - throws IOException - { - throw new InternalError - ("PlainDatagramSocketImpl::joinGroup is not implemented"); - } - - /** - * Leaves a multicast group. - * - * @param socket the socket object - * @param address the socket address - * @param netIf the network interface - * - * @throws IOException if I/O errors occur - */ - static void leaveGroup(PlainDatagramSocketImpl socket, SocketAddress address, - NetworkInterface netIf) - throws IOException - { - throw new InternalError - ("PlainDatagramSocketImpl::leaveGroup is not implemented"); - } - -} Deleted: trunk/core/src/classpath/vm/java/net/VMPlainSocketImpl.java =================================================================== --- trunk/core/src/classpath/vm/java/net/VMPlainSocketImpl.java 2006-12-14 10:25:05 UTC (rev 2921) +++ trunk/core/src/classpath/vm/java/net/VMPlainSocketImpl.java 2006-12-14 10:44:22 UTC (rev 2922) @@ -1,512 +0,0 @@ -/* VMPlainSocketImpl.java -- VM interface for default socket implementation - Copyright (C) 2005, 2006 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.net; - -import java.io.IOException; -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.net.SocketOptions; - -import gnu.classpath.Configuration; -import gnu.java.nio.VMChannel; - -/** - * The VM interface for {@link gnu.java.net.PlainSocketImpl}. - * - * @author Ingo Proetel (pr...@ai...) - * @author Roman Kennke (ke...@ai...) - */ -public final class VMPlainSocketImpl -{ - /** Option id for time to live - */ - private static final int CP_IP_TTL = 0x1E61; - - private final State nfd; - - /** - * Static initializer to load native library. - */ - static - { - if (Configuration.INIT_LOAD_LIBRARY) - { - System.loadLibrary("javanet"); - } - } - - public VMPlainSocketImpl() - { - // XXX consider adding security check here. - nfd = new State(); - } - - public VMPlainSocketImpl(VMChannel channel) throws IOException - { - this(); - nfd.setChannelFD(channel.getState()); - } - - public State getState() - { - return nfd; - } - - /** This method exists to hide the CP_IP_TTL value from - * higher levels. - * - * Always think of JNode ... :) - */ - public void setTimeToLive(int ttl) - throws SocketException - { - try - { - setOption(nfd.getNativeFD(), CP_IP_TTL, ttl); - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } - } - - public int getTimeToLive() - throws SocketException - { - try - { - return getOption(nfd.getNativeFD(), CP_IP_TTL); - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } - } - - public void setOption(int optionId, Object optionValue) - throws SocketException - { - int value; - if (optionValue instanceof Integer) - value = ((Integer) optionValue).intValue(); - else if (optionValue instanceof Boolean) - // Switching off the linger behavior is done by setting - // the value to -1. This is how the Java API interprets - // it. - value = ((Boolean) optionValue).booleanValue() - ? 1 - : (optionId == SocketOptions.SO_LINGER) - ? -1 - : 0; - else - throw new IllegalArgumentException("option value type " - + optionValue.getClass().getName()); - - try - { - setOption(nfd.getNativeFD(), optionId, value); - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } - } - - private static native void setOption(int fd, int id, int value) - throws SocketException; - - public void setMulticastInterface(int optionId, InetAddress addr) - throws SocketException - { - try - { - if (addr instanceof Inet4Address) - setMulticastInterface(nfd.getNativeFD(), optionId, (Inet4Address) addr); - else if (addr instanceof Inet6Address) - { - NetworkInterface iface = NetworkInterface.getByInetAddress(addr); - setMulticastInterface6(nfd.getNativeFD(), optionId, iface.getName()); - } - else - throw new SocketException("Unknown address format: " + addr); - } - catch (SocketException se) - { - throw se; - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } - } - - private static native void setMulticastInterface(int fd, - int optionId, - Inet4Address addr); - - private static native void setMulticastInterface6(int fd, - int optionId, - String ifName); - - /** - * Get a socket option. This implementation is only required to support - * socket options that are boolean values, which include: - * - * SocketOptions.IP_MULTICAST_LOOP - * SocketOptions.SO_BROADCAST - * SocketOptions.SO_KEEPALIVE - * SocketOptions.SO_OOBINLINE - * SocketOptions.SO_REUSEADDR - * SocketOptions.TCP_NODELAY - * - * and socket options that are integer values, which include: - * - * SocketOptions.IP_TOS - * SocketOptions.SO_LINGER - * SocketOptions.SO_RCVBUF - * SocketOptions.SO_SNDBUF - * SocketOptions.SO_TIMEOUT - * - * @param optionId The option ID to fetch. - * @return A {@link Boolean} or {@link Integer} containing the socket - * option. - * @throws SocketException - */ - public Object getOption(int optionId) throws SocketException - { - int value; - try - { - value = getOption(nfd.getNativeFD(), optionId); - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } - - switch (optionId) - { - case SocketOptions.IP_MULTICAST_LOOP: - case SocketOptions.SO_BROADCAST: - case SocketOptions.SO_KEEPALIVE: - case SocketOptions.SO_OOBINLINE: - case SocketOptions.SO_REUSEADDR: - case SocketOptions.TCP_NODELAY: - return Boolean.valueOf(value != 0); - - case SocketOptions.IP_TOS: - case SocketOptions.SO_LINGER: - case SocketOptions.SO_RCVBUF: - case SocketOptions.SO_SNDBUF: - case SocketOptions.SO_TIMEOUT: - return new Integer(value); - - default: - throw new SocketException("getting option " + optionId + - " not supported here"); - } - } - - private static native int getOption(int fd, int id) throws SocketException; - - /** - * Returns an Inet4Address or Inet6Address instance belonging to the - * interface which is set as the multicast interface. - * - * The optionId is provided to make it possible that the native - * implementation may do something different depending on whether - * the value is SocketOptions.IP_MULTICAST_IF or - * SocketOptions.IP_MULTICAST_IF2. - */ - public InetAddress getMulticastInterface(int optionId) - throws SocketException - { - try - { - return getMulticastInterface(nfd.getNativeFD(), optionId); - } - catch (IOException ioe) - { - SocketException se = new SocketException(); - se.initCause(ioe); - throw se; - } - } - - private static native InetAddress getMulticastInterface(int fd, - int optionId); - - /** - * Binds this socket to the given local address and port. - * - * @param address The address to bind to; the InetAddress is either - * an IPv4 or IPv6 address. - * @throws IOException If binding fails; for example, if the port - * in the given InetSocketAddress is privileged, and the current - * process has insufficient privileges. - */ - public void bind(InetSocketAddress address) throws IOException - { - InetAddress addr = address.getAddress(); - if (addr instanceof Inet4Address) - { - bind (nfd.getNativeFD(), addr.getAddress(), address.getPort()); - } - else if (addr instanceof Inet6Address) - bind6 (nfd.getNativeFD(), addr.getAddress(), address.getPort()); - else - throw new SocketException ("unsupported address type"); - } - - /** - * Native bind function for IPv4 addresses. The addr array must be - * exactly four bytes long. - * - * VMs without native support need not implement this. - * - * @param fd The native file descriptor integer. - * @param addr The IPv4 address, in network byte order. - * @param port The port to bind to. - * @throws IOException - */ - private static native void bind(int fd, byte[] addr, int port) - throws IOException; - - /** - * Native bind function for IPv6 addresses. The addr array must be - * exactly sixteen bytes long. - * - * VMs without native support need not implement this. - * - * @param fd The native file descriptor integer. - * @param addr The IPv6 address, in network byte order. - * @param port The port to bind to. - * @throws IOException - */ - private static native void bind6(int fd, byte[] addr, int port) - throws IOException; - - /** - * Listen on this socket for incoming connections. - * - * @param backlog The backlog of connections. - * @throws IOException If listening fails. - * @see gnu.java.nio.VMChannel#accept() - */ - public void listen(int backlog) throws IOException - { - listen(nfd.getNativeFD(), backlog); - } - - /** - * Native listen function. VMs without native support need not implement - * this. - * - * @param fd The file descriptor integer. - * @param backlog The listen backlog size. - * @throws IOException - */ - private static native void listen(int fd, int backlog) throws IOException; - - public void join(InetAddress group) throws IOException - { - if (group instanceof Inet4Address) - join(nfd.getNativeFD(), group.getAddress()); - else if (group instanceof Inet6Address) - join6(nfd.getNativeFD(), group.getAddress()); - else - throw new IllegalArgumentException("unknown address type"); - } - - private static native void join(int fd, byte[] addr) throws IOException; - - private static native void join6(int fd, byte[] addr) throws IOException; - - public void leave(InetAddress group) throws IOException - { - if (group instanceof Inet4Address) - leave(nfd.getNativeFD(), group.getAddress()); - else if (group instanceof Inet6Address) - leave6(nfd.getNativeFD(), group.getAddress()); - else - throw new IllegalArgumentException("unknown address type"); - } - - private static native void leave(int fd, byte[] addr) throws IOException; - - private static native void leave6(int fd, byte[] addr) throws IOException; - - public void joinGroup(InetSocketAddress addr, NetworkInterface netif) - throws IOException - { - InetAddress address = addr.getAddress(); - - if (address instanceof Inet4Address) - joinGroup(nfd.getNativeFD(), address.getAddress(), - netif != null ? netif.getName() : null); - else if (address instanceof Inet6Address) - joinGroup6(nfd.getNativeFD(), address.getAddress(), - netif != null ? netif.getName() : null); - else - throw new IllegalArgumentException("unknown address type"); - } - - private static native void joinGroup(int fd, byte[] addr, String ifname) - throws IOException; - - private static native void joinGroup6(int fd, byte[] addr, String ifname) - throws IOException; - - public void leaveGroup(InetSocketAddress addr, NetworkInterface netif) - throws IOException - { - InetAddress address = addr.getAddress(); - if (address instanceof Inet4Address) - leaveGroup(nfd.getNativeFD(), address.getAddress(), - netif != null ? netif.getName() : null); - else if (address instanceof Inet6Address) - leaveGroup6(nfd.getNativeFD(), address.getAddress(), - netif != null ? netif.getName() : null); - else - throw new IllegalArgumentException("unknown address type"); - } - - private static native void leaveGroup(int fd, byte[] addr, String ifname) - throws IOException; - - private static native void leaveGroup6(int fd, byte[] addr, String ifname) - throws IOException; - - - public void shutdownInput() throws IOException - { - shutdownInput(nfd.getNativeFD()); - } - - private static native void shutdownInput(int native_fd) throws IOException; - - public void shutdownOutput() throws IOException - { - shutdownOutput(nfd.getNativeFD()); - } - - private static native void shutdownOutput(int native_fd) throws IOException; - - public void sendUrgentData(int data) throws IOException - { - sendUrgentData(nfd.getNativeFD(), data); - } - - private static native void sendUrgentData(int natfive_fd, int data) throws IOException; - - public void close() throws IOException - { - nfd.close(); - } - - // Inner classes. - - /** - * Our wrapper for the native file descriptor. In this implementation, - * it is a simple wrapper around {@link VMChannel.State}, to simplify - * management of the native state. - */ - public final class State - { - private VMChannel.State channelFd; - - State() - { - channelFd = null; - } - - public boolean isValid() - { - if (channelFd != null) - return channelFd.isValid(); - return false; - } - - public int getNativeFD() throws IOException - { - return channelFd.getNativeFD(); - } - - public void setChannelFD(final VMChannel.State nfd) throws IOException - { - if (this.channelFd != null && this.channelFd.isValid()) - throw new IOException("file descriptor already initialized"); - this.channelFd = nfd; - } - - public void close() throws IOException - { - if (channelFd == null) - throw new IOException("invalid file descriptor"); - channelFd.close(); - } - - protected void finalize() throws Throwable - { - try - { - if (isValid()) - close(); - } - finally - { - super.finalize(); - } - } - } -} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2006-12-14 10:25:07
|
Revision: 2921 http://jnode.svn.sourceforge.net/jnode/?rev=2921&view=rev Author: galatnm Date: 2006-12-14 02:25:05 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Commit ThreadCommandInvoker patch from crawley. Modified Paths: -------------- trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java Modified: trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java =================================================================== --- trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java 2006-12-14 10:18:42 UTC (rev 2920) +++ trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java 2006-12-14 10:25:05 UTC (rev 2921) @@ -29,6 +29,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.lang.reflect.InvocationTargetException; @@ -53,6 +54,24 @@ * @author Martin Husted Hartvig (ha...@jn...) */ public class ThreadCommandInvoker implements CommandInvoker, KeyboardListener { + + private class StreamHolder { + InputStream inputStream, nextInputStream; + PrintStream errStream, outputStream; + ByteArrayOutputStream byteArrayOutputStream; + + public StreamHolder(InputStream inputStream, PrintStream outputStream, PrintStream errStream) { + this.inputStream = inputStream; + this.errStream = errStream; + this.outputStream = outputStream; + } + } + + private class NoGo extends Exception { + NoGo(Throwable cause) { + super(cause); + } + } PrintStream err; @@ -85,20 +104,14 @@ public void invoke(String cmdLineStr) { commandShell.addCommandToHistory(cmdLineStr); + StreamHolder streams = new StreamHolder(System.in, null, System.err); - InputStream inputStream = System.in; // will also be dynamic later - InputStream nextInputStream = null; - PrintStream errStream = System.err; // will also be dynamic later - PrintStream outputStream = null; - CommandLine cmdLine; - Method method; CommandRunner cr; CommandInfo cmdInfo; String[] commands = cmdLineStr.split("\\|"); String command; - ByteArrayOutputStream byteArrayOutputStream = null; for (int i = 0; i < commands.length; i++) { command = commands[i].trim(); @@ -112,59 +125,17 @@ try { cmdInfo = commandShell.getCommandClass(cmdName); - try { - method = cmdInfo.getCommandClass().getMethod( - EXECUTE_METHOD, EXECUTE_ARG_TYPES); - - if (cmdLine.sendToOutFile()) { - File file = new File(cmdLine.getOutFileName()); - - try { - FileOutputStream fileOutputStream = new FileOutputStream( - file); - outputStream = new PrintStream(fileOutputStream); - } catch (SecurityException e) { - e.printStackTrace(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - } else if (i + 1 < commands.length) { - byteArrayOutputStream = new ByteArrayOutputStream(); - outputStream = new PrintStream(byteArrayOutputStream); - } else { - outputStream = System.out; - } - - if (byteArrayOutputStream != null) { - nextInputStream = new ByteArrayInputStream( - byteArrayOutputStream.toByteArray()); - } - - if (nextInputStream != null) - inputStream = nextInputStream; - - CommandLine commandLine = null; - - if (inputStream.available() > 0) { - commandLine = new CommandLine(inputStream); - } else { - commandLine = cmdLine.getRemainder(); - } - - commandLine.setOutFileName(cmdLine.getOutFileName()); - - cr = new CommandRunner(cmdInfo.getCommandClass(), method, - new Object[] { commandLine, inputStream, - outputStream, errStream }); - } catch (NoSuchMethodException e) { - method = cmdInfo.getCommandClass().getMethod(MAIN_METHOD, - MAIN_ARG_TYPES); - cr = new CommandRunner(cmdInfo.getCommandClass(), method, - new Object[] { cmdLine.getRemainder() - .toStringArray() }); + cr = buildExecuteRunner(cmdName, cmdLine, cmdInfo, + streams, i != commands.length - 1); + if (cr == null) { + cr = buildMainRunner(cmdName, cmdLine, cmdInfo); } + if (cr == null) { + err.println("Class " + cmdInfo.getCommandClass().getName() + + " has no suitable 'execute' or 'main' method"); + break; + } try { - if (cmdInfo.isInternal()) { cr.run(); } else { @@ -185,22 +156,24 @@ } } } - } - if (outputStream != null && outputStream != System.out) { - outputStream.close(); + if (streams.outputStream != null && streams.outputStream != System.out) { + streams.outputStream.close(); } // System.err.println("Finished invoke."); } catch (Exception ex) { err.println("Exception in command"); ex.printStackTrace(err); + break; } catch (Error ex) { err.println("Fatal error in command"); ex.printStackTrace(err); + break; } - } catch (NoSuchMethodException ex) { - err.println("Alias class has no main method " + cmdName); + } catch (NoGo ex) { + err.println("Exception occurred while prepareing to run command"); + ex.getCause().printStackTrace(err); } catch (ClassNotFoundException ex) { err.println("Unknown alias class " + ex.getMessage()); } catch (ClassCastException ex) { @@ -210,9 +183,89 @@ ex.printStackTrace(err); } } + } + + private CommandRunner buildExecuteRunner(String cmdName, + CommandLine cmdLine, CommandInfo cmdInfo, StreamHolder streams, boolean last) + throws NoGo { + Method method; + Object target; + try { + method = cmdInfo.getCommandClass().getMethod( + EXECUTE_METHOD, EXECUTE_ARG_TYPES); + if ((method.getModifiers() & Modifier.STATIC) == 0) { + return null; + } + } + catch (NoSuchMethodException ex) { + return null; + } - nextInputStream = null; + try { + target = cmdInfo.getCommandClass().newInstance(); + } + catch (Exception ex) { + throw new NoGo(ex); + } + + if (cmdLine.sendToOutFile()) { + File file = new File(cmdLine.getOutFileName()); + + try { + FileOutputStream fileOutputStream = new FileOutputStream( + file); + streams.outputStream = new PrintStream(fileOutputStream); + } catch (SecurityException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } else if (!last) { + streams.byteArrayOutputStream = new ByteArrayOutputStream(); + streams.outputStream = new PrintStream(streams.byteArrayOutputStream); + } else { + streams.outputStream = System.out; + } + + if (streams.byteArrayOutputStream != null) { + streams.nextInputStream = new ByteArrayInputStream( + streams.byteArrayOutputStream.toByteArray()); + } + + if (streams.nextInputStream != null) + streams.inputStream = streams.nextInputStream; + + CommandLine commandLine; + try { + commandLine = (streams.inputStream.available() > 0) ? + new CommandLine(streams.inputStream) : cmdLine.getRemainder(); + } + catch (IOException ex) { + throw new NoGo(ex); + } + + commandLine.setOutFileName(cmdLine.getOutFileName()); + + return new CommandRunner(cmdInfo.getCommandClass(), method, target, + new Object[] { commandLine, streams.inputStream, + streams.outputStream, streams.errStream }); } + + private CommandRunner buildMainRunner(String cmdName, + CommandLine cmdLine, CommandInfo cmdInfo) { + try { + Method method = + cmdInfo.getCommandClass().getMethod(MAIN_METHOD, MAIN_ARG_TYPES); + if ((method.getModifiers() & Modifier.STATIC) == 0) { + return null; + } + return new CommandRunner(cmdInfo.getCommandClass(), method, null, + new Object[] {cmdLine.getRemainder().toStringArray()}); + } + catch (NoSuchMethodException ex) { + return null; + } + } public void keyPressed(KeyboardEvent ke) { if (ke.isControlDown() && ke.getKeyCode() == KeyEvent.VK_C) { @@ -259,41 +312,27 @@ class CommandRunner implements Runnable { - private Class cx; + private final Class cx; + private final Method method; + private final Object target; + private final Object[] args; - Method method; - - Object[] args; - boolean finished = false; - public CommandRunner(Class cx, Method method, Object[] args) { + public CommandRunner(Class cx, Method method, Object target, Object[] args) { this.cx = cx; this.method = method; this.args = args; + this.target = target; } public void run() { try { // System.err.println("Registering shell in new thread."); - // to - // ensure - // access - // to - // the - // command - // shell - // in - // this - // new - // thread? try { - Object obj = null; - if(!Modifier.isStatic(method.getModifiers())) { - obj = cx.newInstance(); - } - AccessController.doPrivileged(new InvokeAction(method, - obj, args)); + + AccessController.doPrivileged( + new InvokeAction(method, target, args)); } catch (PrivilegedActionException ex) { throw ex.getException(); } @@ -307,28 +346,32 @@ unblock(); } } catch (InvocationTargetException ex) { - Throwable tex = ex.getTargetException(); - if (tex instanceof SyntaxErrorException) { - try { - Help.getInfo(cx).usage(); - } catch (HelpException ex1) { - // Don't care - ex1.printStackTrace(); - } - err.println(tex.getMessage()); - unblock(); - } else if (tex instanceof VmExit) { - err.println(tex.getMessage()); - unblock(); - } else { - err.println("Exception in command"); - tex.printStackTrace(err); - unblock(); - } + Throwable tex = ex.getTargetException(); + if (tex instanceof SyntaxErrorException) { + try { + Help.getInfo(cx).usage(); + } catch (HelpException ex1) { + // Don't care + ex1.printStackTrace(); + } + err.println(tex.getMessage()); + unblock(); + } else if (tex instanceof VmExit) { + err.println(tex.getMessage()); + unblock(); + } else { + err.println("Exception in command"); + tex.printStackTrace(err); + unblock(); + } } catch (Exception ex) { - err.println("Exception in command"); - ex.printStackTrace(err); - unblock(); + err.println("Exception in command"); + ex.printStackTrace(err); + unblock(); + } catch (Error ex) { + err.println("Error in command"); + ex.printStackTrace(err); + unblock(); } finished = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2006-12-14 10:18:45
|
Revision: 2920 http://jnode.svn.sourceforge.net/jnode/?rev=2920&view=rev Author: hagar-wize Date: 2006-12-14 02:18:42 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Classpath patches Modified Paths: -------------- trunk/core/src/classpath/vm/gnu/java/nio/VMPipe.java trunk/core/src/classpath/vm/gnu/java/nio/VMSelector.java Added Paths: ----------- trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java Added: trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java =================================================================== --- trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java (rev 0) +++ trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java 2006-12-14 10:18:42 UTC (rev 2920) @@ -0,0 +1,750 @@ +/* VMChannel.java -- Native interface suppling channel operations. + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.java.nio; + +import gnu.classpath.Configuration; + +import java.io.IOException; +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.net.SocketException; +import java.nio.ByteBuffer; +import java.nio.MappedByteBuffer; + +/** + * Native interface to support configuring of channel to run in a non-blocking + * manner and support scatter/gather io operations. + * + * @author Michael Barker <mi...@mi...> + * + */ +public final class VMChannel +{ + /** + * Our reference implementation uses an integer to store the native + * file descriptor. Implementations without such support + */ + private final State nfd; + + private Kind kind; + + public VMChannel() + { + // XXX consider adding security check here, so only Classpath + // code may create instances. + this.nfd = new State(); + kind = Kind.OTHER; + } + + /** + * This constructor is used by the POSIX reference implementation; + * other virtual machines need not support it. + * + * <strong>Important:</strong> do not call this in library code that is + * not specific to Classpath's reference implementation. + * + * @param native_fd The native file descriptor integer. + * @throws IOException + */ + VMChannel(final int native_fd) throws IOException + { + this(); + this.nfd.setNativeFD(native_fd); + } + + public State getState() + { + return nfd; + } + + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + initIDs(); + } + + public static VMChannel getStdin() throws IOException + { + return new VMChannel(stdin_fd()); + } + + public static VMChannel getStdout() throws IOException + { + return new VMChannel(stdout_fd()); + } + + public static VMChannel getStderr() throws IOException + { + return new VMChannel(stderr_fd()); + } + + private static native int stdin_fd(); + private static native int stdout_fd(); + private static native int stderr_fd(); + + /** + * Set the file descriptor to have the required blocking + * setting. + * + * @param blocking The blocking flag to set. + */ + public void setBlocking(boolean blocking) throws IOException + { + setBlocking(nfd.getNativeFD(), blocking); + } + + private static native void setBlocking(int fd, boolean blocking) + throws IOException; + + public int available() throws IOException + { + return available(nfd.getNativeFD()); + } + + private static native int available(int native_fd) throws IOException; + + /** + * Reads a byte buffer directly using the supplied file descriptor. + * + * @param dst Direct Byte Buffer to read to. + * @return Number of bytes read. + * @throws IOException If an error occurs or dst is not a direct buffers. + */ + public int read(ByteBuffer dst) + throws IOException + { + return read(nfd.getNativeFD(), dst); + } + + private static native int read(int fd, ByteBuffer dst) throws IOException; + + /** + * Read a single byte. + * + * @return The byte read, or -1 on end of file. + * @throws IOException + */ + public int read() throws IOException + { + return read(nfd.getNativeFD()); + } + + private static native int read(int fd) throws IOException; + + /** + * Reads into byte buffers directly using the supplied file descriptor. + * Assumes that the buffer list contains DirectBuffers. Will perform a + * scattering read. + * + * @param dsts An array direct byte buffers. + * @param offset Index of the first buffer to read to. + * @param length The number of buffers to read to. + * @return Number of bytes read. + * @throws IOException If an error occurs or the dsts are not direct buffers. + */ + public long readScattering(ByteBuffer[] dsts, int offset, int length) + throws IOException + { + if (offset + length > dsts.length) + throw new IndexOutOfBoundsException("offset + length > dsts.length"); + + return readScattering(nfd.getNativeFD(), dsts, offset, length); + } + + private static native long readScattering(int fd, ByteBuffer[] dsts, + int offset, int length) + throws IOException; + + /** + * Receive a datagram on this channel, returning the host address + * that sent the datagram. + * + * @param dst Where to store the datagram. + * @return The host address that sent the datagram. + * @throws IOException + */ + public SocketAddress receive(ByteBuffer dst) throws IOException + { + if (kind != Kind.SOCK_DGRAM) + throw new SocketException("not a datagram socket"); + ByteBuffer hostPort = ByteBuffer.allocateDirect(18); + int hostlen = receive(nfd.getNativeFD(), dst, hostPort); + if (hostlen == 0) + return null; + if (hostlen == 4) // IPv4 + { + byte[] addr = new byte[4]; + hostPort.get(addr); + int port = hostPort.getShort() & 0xFFFF; + return new InetSocketAddress(Inet4Address.getByAddress(addr), port); + } + if (hostlen == 16) // IPv6 + { + byte[] addr = new byte[16]; + hostPort.get(addr); + int port = hostPort.getShort() & 0xFFFF; + return new InetSocketAddress(Inet6Address.getByAddress(addr), port); + } + + throw new SocketException("host address received with invalid length: " + + hostlen); + } + + private static native int receive (int fd, ByteBuffer dst, ByteBuffer address) + throws IOException; + + /** + * Writes from a direct byte bufer using the supplied file descriptor. + * Assumes the buffer is a DirectBuffer. + * + * @param src The source buffer. + * @return Number of bytes written. + * @throws IOException + */ + public int write(ByteBuffer src) throws IOException + { + return write(nfd.getNativeFD(), src); + } + + private native int write(int fd, ByteBuffer src) throws IOException; + + /** + * Writes from byte buffers directly using the supplied file descriptor. + * Assumes the that buffer list constains DirectBuffers. Will perform + * as gathering write. + * + * @param fd + * @param srcs + * @param offset + * @param length + * @return Number of bytes written. + * @throws IOException + */ + public long writeGathering(ByteBuffer[] srcs, int offset, int length) + throws IOException + { + if (offset + length > srcs.length) + throw new IndexOutOfBoundsException("offset + length > srcs.length"); + + // A gathering write is limited to 16 buffers; when writing, ensure + // that we have at least one buffer with something in it in the 16 + // buffer window starting at offset. + while (!srcs[offset].hasRemaining() && offset < srcs.length) + offset++; + + // There are no buffers with anything to write. + if (offset == srcs.length) + return 0; + + // If we advanced `offset' so far that we don't have `length' + // buffers left, reset length to only the remaining buffers. + if (length > srcs.length - offset) + length = srcs.length - offset; + + return writeGathering(nfd.getNativeFD(), srcs, offset, length); + } + + private native long writeGathering(int fd, ByteBuffer[] srcs, + int offset, int length) + throws IOException; + + /** + * Send a datagram to the given address. + * + * @param src The source buffer. + * @param dst The destination address. + * @return The number of bytes written. + * @throws IOException + */ + public int send(ByteBuffer src, InetSocketAddress dst) + throws IOException + { + InetAddress addr = dst.getAddress(); + if (addr == null) + throw new NullPointerException(); + if (addr instanceof Inet4Address) + return send(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort()); + else if (addr instanceof Inet6Address) + return send6(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort()); + else + throw new SocketException("unrecognized inet address type"); + } + + // Send to an IPv4 address. + private static native int send(int fd, ByteBuffer src, byte[] addr, int port) + throws IOException; + + // Send to an IPv6 address. + private static native int send6(int fd, ByteBuffer src, byte[] addr, int port) + throws IOException; + + /** + * Write a single byte. + * + * @param b The byte to write. + * @throws IOException + */ + public void write(int b) throws IOException + { + write(nfd.getNativeFD(), b); + } + + private static native void write(int fd, int b) throws IOException; + + private native static void initIDs(); + + // Network (socket) specific methods. + + /** + * Create a new socket. This method will initialize the native file + * descriptor state of this instance. + * + * @param stream Whether or not to create a streaming socket, or a datagram + * socket. + * @throws IOException If creating a new socket fails, or if this + * channel already has its native descriptor initialized. + */ + public void initSocket(boolean stream) throws IOException + { + if (nfd.isValid()) + throw new IOException("native FD already initialized"); + if (stream) + kind = Kind.SOCK_STREAM; + else + kind = Kind.SOCK_DGRAM; + nfd.setNativeFD(socket(stream)); + } + + /** + * Create a new socket, returning the native file descriptor. + * + * @param stream Set to true for streaming sockets; false for datagrams. + * @return The native file descriptor. + * @throws IOException If creating the socket fails. + */ + private static native int socket(boolean stream) throws IOException; + + /** + * Connect the underlying socket file descriptor to the remote host. + * + * @param saddr The address to connect to. + * @param timeout The connect timeout to use for blocking connects. + * @return True if the connection succeeded; false if the file descriptor + * is in non-blocking mode and the connection did not immediately + * succeed. + * @throws IOException If an error occurs while connecting. + */ + public boolean connect(InetSocketAddress saddr, int timeout) + throws SocketException + { + int fd; + + InetAddress addr = saddr.getAddress(); + + // Translates an IOException into a SocketException to conform + // to the throws clause. + try + { + fd = nfd.getNativeFD(); + } + catch (IOException ioe) + { + throw new SocketException(ioe.getMessage()); + } + + if (addr instanceof Inet4Address) + return connect(fd, addr.getAddress(), saddr.getPort(), + timeout); + if (addr instanceof Inet6Address) + return connect6(fd, addr.getAddress(), saddr.getPort(), + timeout); + throw new SocketException("unsupported internet address"); + } + + private static native boolean connect(int fd, byte[] addr, int port, int timeout) + throws SocketException; + + private static native boolean connect6(int fd, byte[] addr, int port, int timeout) + throws SocketException; + + /** + * Disconnect this channel, if it is a datagram socket. Disconnecting + * a datagram channel will disassociate it from any address, so the + * socket will remain open, but can send and receive datagrams from + * any address. + * + * @throws IOException If disconnecting this channel fails, or if this + * channel is not a datagram channel. + */ + public void disconnect() throws IOException + { + if (kind != Kind.SOCK_DGRAM) + throw new IOException("can only disconnect datagram channels"); + disconnect(nfd.getNativeFD()); + } + + private static native void disconnect(int fd) throws IOException; + + public InetSocketAddress getLocalAddress() throws IOException + { + if (!nfd.isValid()) + return null; + ByteBuffer name = ByteBuffer.allocateDirect(18); + int namelen = getsockname(nfd.getNativeFD(), name); + if (namelen == 0) // not bound + return null; // XXX return some wildcard? + if (namelen == 4) + { + byte[] addr = new byte[4]; + name.get(addr); + int port = name.getShort() & 0xFFFF; + return new InetSocketAddress(Inet4Address.getByAddress(addr), port); + } + if (namelen == 16) + { + byte[] addr = new byte[16]; + name.get(addr); + int port = name.getShort() & 0xFFFF; + return new InetSocketAddress(Inet6Address.getByAddress(addr), port); + } + throw new SocketException("invalid address length"); + } + + private static native int getsockname(int fd, ByteBuffer name) + throws IOException; + + /** + * Returns the socket address of the remote peer this channel is connected + * to, or null if this channel is not yet connected. + * + * @return The peer address. + * @throws IOException + */ + public InetSocketAddress getPeerAddress() throws IOException + { + if (!nfd.isValid()) + return null; + ByteBuffer name = ByteBuffer.allocateDirect(18); + int namelen = getpeername (nfd.getNativeFD(), name); + if (namelen == 0) // not connected yet + return null; + if (namelen == 4) // IPv4 + { + byte[] addr = new byte[4]; + name.get(addr); + int port = name.getShort() & 0xFFFF; + return new InetSocketAddress(Inet4Address.getByAddress(addr), port); + } + else if (namelen == 16) // IPv6 + { + byte[] addr = new byte[16]; + name.get(addr); + int port = name.getShort() & 0xFFFF; + return new InetSocketAddress(Inet6Address.getByAddress(addr), port); + } + throw new SocketException("invalid address length"); + } + + /* + * The format here is the peer address, followed by the port number. + * The returned value is the length of the peer address; thus, there + * will be LEN + 2 valid bytes put into NAME. + */ + private static native int getpeername(int fd, ByteBuffer name) + throws IOException; + + /** + * Accept an incoming connection, returning a new VMChannel, or null + * if the channel is nonblocking and no connection is pending. + * + * @return The accepted connection, or null. + * @throws IOException If an IO error occurs. + */ + public VMChannel accept() throws IOException + { + int new_fd = accept(nfd.getNativeFD()); + if (new_fd == -1) // non-blocking accept had no pending connection + return null; + return new VMChannel(new_fd); + } + + private static native int accept(int native_fd) throws IOException; + + // File-specific methods. + + /** + * Open a file at PATH, initializing the native state to operate on + * that open file. + * + * @param path The absolute file path. + * @throws IOException If the file cannot be opened, or if this + * channel was previously initialized. + */ + public void openFile(String path, int mode) throws IOException + { + if (nfd.isValid() || nfd.isClosed()) + throw new IOException("can't reinitialize this channel"); + int fd = open(path, mode); + nfd.setNativeFD(fd); + kind = Kind.FILE; + } + + private static native int open(String path, int mode) throws IOException; + + public long position() throws IOException + { + if (kind != Kind.FILE) + throw new IOException("not a file"); + return position(nfd.getNativeFD()); + } + + private static native long position(int fd) throws IOException; + + public void seek(long pos) throws IOException + { + if (kind != Kind.FILE) + throw new IOException("not a file"); + seek(nfd.getNativeFD(), pos); + } + + private static native void seek(int fd, long pos) throws IOException; + + public void truncate(long length) throws IOException + { + if (kind != Kind.FILE) + throw new IOException("not a file"); + truncate(nfd.getNativeFD(), length); + } + + private static native void truncate(int fd, long len) throws IOException; + + public boolean lock(long pos, long len, boolean shared, boolean wait) + throws IOException + { + if (kind != Kind.FILE) + throw new IOException("not a file"); + return lock(nfd.getNativeFD(), pos, len, shared, wait); + } + + private static native boolean lock(int fd, long pos, long len, + boolean shared, boolean wait) + throws IOException; + + public void unlock(long pos, long len) throws IOException + { + if (kind != Kind.FILE) + throw new IOException("not a file"); + unlock(nfd.getNativeFD(), pos, len); + } + + private static native void unlock(int fd, long pos, long len) throws IOException; + + public long size() throws IOException + { + if (kind != Kind.FILE) + throw new IOException("not a file"); + return size(nfd.getNativeFD()); + } + + private static native long size(int fd) throws IOException; + + public MappedByteBuffer map(char mode, long position, int size) + throws IOException + { + if (kind != Kind.FILE) + throw new IOException("not a file"); + return map(nfd.getNativeFD(), mode, position, size); + } + + private static native MappedByteBuffer map(int fd, char mode, + long position, int size) + throws IOException; + + public boolean flush(boolean metadata) throws IOException + { + if (kind != Kind.FILE) + throw new IOException("not a file"); + return flush(nfd.getNativeFD(), metadata); + } + + private static native boolean flush(int fd, boolean metadata) throws IOException; + + // Close. + + /** + * Close this socket. The socket is also automatically closed when this + * object is finalized. + * + * @throws IOException If closing the socket fails, or if this object has + * no open socket. + */ + public void close() throws IOException + { + nfd.close(); + } + + static native void close(int native_fd) throws IOException; + + /** + * <p>Provides a simple mean for the JNI code to find out whether the + * current thread was interrupted by a call to Thread.interrupt().</p> + * + * @return + */ + static boolean isThreadInterrupted() + { + return Thread.currentThread().isInterrupted(); + } + + // Inner classes. + + /** + * A wrapper for a native file descriptor integer. This tracks the state + * of an open file descriptor, and ensures that + * + * This class need not be fully supported by virtual machines; if a + * virtual machine does not use integer file descriptors, or does and + * wishes to hide that, then the methods of this class may be stubbed out. + * + * System-specific classes that depend on access to native file descriptor + * integers SHOULD declare this fact. + */ + public final class State + { + private int native_fd; + private boolean valid; + private boolean closed; + + State() + { + native_fd = -1; + valid = false; + closed = false; + } + + public boolean isValid() + { + return valid; + } + + public boolean isClosed() + { + return closed; + } + + public int getNativeFD() throws IOException + { + if (!valid) + throw new IOException("invalid file descriptor"); + return native_fd; + } + + void setNativeFD(final int native_fd) throws IOException + { + if (valid) + throw new IOException("file descriptor already initialized"); + this.native_fd = native_fd; + valid = true; + } + + public void close() throws IOException + { + if (!valid) + throw new IOException("invalid file descriptor"); + try + { + VMChannel.close(native_fd); + } + finally + { + valid = false; + closed = true; + } + } + + public String toString() + { + if (closed) + return "<<closed>>"; + if (!valid) + return "<<invalid>>"; + return String.valueOf(native_fd); + } + + protected void finalize() throws Throwable + { + try + { + if (valid) + close(); + } + finally + { + super.finalize(); + } + } + } + + /** + * An enumeration of possible kinds of channel. + */ + static class Kind // XXX enum + { + /** A streaming (TCP) socket. */ + static final Kind SOCK_STREAM = new Kind(); + + /** A datagram (UDP) socket. */ + static final Kind SOCK_DGRAM = new Kind(); + + /** A file. */ + static final Kind FILE = new Kind(); + + /** Something else; not a socket or file. */ + static final Kind OTHER = new Kind(); + + private Kind() { } + } +} Modified: trunk/core/src/classpath/vm/gnu/java/nio/VMPipe.java =================================================================== --- trunk/core/src/classpath/vm/gnu/java/nio/VMPipe.java 2006-12-14 10:17:15 UTC (rev 2919) +++ trunk/core/src/classpath/vm/gnu/java/nio/VMPipe.java 2006-12-14 10:18:42 UTC (rev 2920) @@ -1,28 +1,43 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2006 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +/* VMPipe.java -- Reference implementation for VM hooks used by PipeImpl + Copyright (C) 2004 Free Software Foundation +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + package gnu.java.nio; import java.io.IOException; -import java.nio.channels.spi.SelectorProvider; import gnu.classpath.Configuration; /** @@ -43,6 +58,23 @@ } } - static native void init(PipeImpl self, SelectorProvider provider) - throws IOException; + /** + * Create a pipe, consisting of a readable VMChannel and a writable + * VMChannel. The readable channel is returned is the first element + * of the array, and the writable in the second. + * + * @return A pair of VMChannels; the first readable, the second + * writable. + * @throws IOException If the pipe cannot be created. + */ + static VMChannel[] pipe() throws IOException + { + VMChannel[] pipe = new VMChannel[2]; + int[] fds = pipe0(); + pipe[0] = new VMChannel(fds[0]); + pipe[1] = new VMChannel(fds[1]); + return pipe; } + + private static native int[] pipe0() throws IOException; +} Modified: trunk/core/src/classpath/vm/gnu/java/nio/VMSelector.java =================================================================== --- trunk/core/src/classpath/vm/gnu/java/nio/VMSelector.java 2006-12-14 10:17:15 UTC (rev 2919) +++ trunk/core/src/classpath/vm/gnu/java/nio/VMSelector.java 2006-12-14 10:18:42 UTC (rev 2920) @@ -1,24 +1,40 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2006 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - +/* VMSelector.java -- + Copyright (C) 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + package gnu.java.nio; import gnu.classpath.Configuration; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |