⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vmintegration.texinfo

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 TEXINFO
📖 第 1 页 / 共 5 页
字号:
\input texinfo @c -*-texinfo-*-@c %**start of header@setfilename vmintegration.info@settitle GNU Classpath VM Integration Guide@c %**end of header@setchapternewpage off@ifinfoThis file contains important information you will need to know if youare going to write an interface between GNU Classpath and a VirtualMachine.Copyright (C) 1998-2002, 2004, 2005 Free Software Foundation, Inc.@ifnotplaintext@dircategory GNU Libraries@direntry* VM Integration: (vmintegration).   GNU Classpath VM Integration Guide@end direntry@end ifnotplaintext@end ifinfo@titlepage@title GNU Classpath VM Integration Guide@author John Keiser@author C. Brian Jones@author Mark Wielaard@page@vskip 0pt plus 1filllCopyright @copyright{} 1998-2002 Free Software Foundation, Inc.@sp 2Permission is granted to make and distribute verbatim copies ofthis document provided the copyright notice and this permission noticeare preserved on all copies.Permission is granted to copy and distribute modified versions of thisdocument under the conditions for verbatim copying, provided that theentire resulting derived work is distributed under the terms of apermission notice identical to this one.Permission is granted to copy and distribute translations of this manualinto another language, under the above conditions for modified versions,except that this permission notice may be stated in a translationapproved by the Free Software Foundation.@end titlepage@ifinfo@node Top, Introduction, (dir), (dir)@top GNU Classpath Hacker's GuideThis file contains important information you will need to know if youare going to write an interface between GNU Classpath and a VirtualMachine.This document is incomplete, as we are still in alpha with the interface.@end ifinfo@menu* Introduction::                An introduction to the Classpath project* Initialization::              Initializing the classes* Classpath Hooks::             Hooks from Classpath to the VM* VM Hooks::                    Hooks from the underlying VM to Classpath* JNI Implementation::		Hooking the VM to jni.h* Miscellaneous VM Requirements::  @end menu@node Introduction, Initialization, Top, Top@comment node-name, next, previous, up@chapter IntroductionThe Classpath Project's ambition to be a 100% clean room implementationof the standard Java class libraries cannot be fulfilled without somelevel of integration with the Virtual Machine, the underlying machinerythat actually runs Java.There are several VMs out there, here is a small list.@itemize @bullet@item @uref{http://www.hungry.com/old-hungry/products/japhar/,Japhar}Japhar was the first VM to use GNU Classpath.  Today you can see thatsort of relationship in the source tree which denotes several Japharspecific files as a reference implementation of those pieces.  This VMhas been primarily tested against Linux and lacks garbage collections, aJIT, and suffers recently from slow development.@item @uref{http://www.intel.com/research/mrl/orp/,Intel's Open Runtime Platform}Intel surprised us not long ago with the release of this rather advancedVM that uses GNU Classpath for a set of class libraries and works onLinux and Windows 2000.  As of June, 2004, it does not appear that ORPis under active development.@item @uref{http://www.sablevm.org/,SableVM}SableVM is a robust, extremely portable, efficient, andspecifications-compliant Java Virtual Machine that aims to be easy tomaintain and to extend. It features a state-of-the-art, efficientinterpreter engine. Its source code is very accessible and easy tounderstand, and has many robustness features that have been the objectof careful design.@item @uref{http://www.kaffe.org,Kaffe}Kaffe is an advanced VM and together with its own class librariesprovides a Java 1.1 compatible environment.@item @uref{http://www.mozilla.org/projects/ef,Electrical Fire}The Electrical File VM continues to be listed as a Mozilla projectthough development has been somewhat quiet.  A number of concepts fromEF were expected at one point to be rolled into Japhar, but thatdevelopment has not occurred as of yet.@item @uref{http://latte.snu.ac.kr/,LaTTe}This VM project so far supports only Sun UltraSparc processors using theproprietary Solaris 2.5.1 or higher operating system.  LaTTe was derivedfrom Kaffe but claims a number of improvements.@item @uref{http://gcc.gnu.org/java/,GNU Compiler for Java (GCJ)}This is a portable, optimizing, ahead-of-time compiler for the JavaProgramming Language. It can compile Java source code directly to nativemachine code, Java source code to Java bytecode (class files), and Javabytecode to native machine code. Compiled applications are linked with theGCJ runtime, libgcj which is based on the GNU Classpath code, which providesthe core class libraries, a garbage collector, and a bytecode interpreter.libgcj can dynamically load and interpret class files, resulting in mixedcompiled/interpreted applications.GCJ is part of the GNU Compiler Collection (@uref{http://gcc.gnu.org/,GCC}).On March 6 2000 the libgcj and GNU Classpath projects were officially mergedand there is active work on merging all the classes between the projects.Licensed under GPL+exception, just as GNU Classpath is.@item @uref{http://kissme.sourceforge.net/,Kissme}This is a free Java Virtual Machine that is being developed on GNU/Linuxand can run console Java applications.  Kissme also provides support fororthogonally persistent Java.@c I don't know what ``orthogonally persistent Java'' is, and I bet@c there are other people don't know either. -- Steve Augart, 4 June 2004@item @uref{http://jamvm.sourceforge.net/,JamVM}A simple, small bytecode interpreter that works out-of-the-box withpure GNU Classpath; it is emerging as the preferred platform forquickly testing a new build of GNU Classpath.  Licensed under the GPL.@item @uref{http://oss.software.ibm.com/jikesrvm,Jikes RVM}A free runtime environment for Java, written in Java.  Worksout-of-the-box with pure GNU Classpath.  Features an optimizing JIT.Runs on the x86 and PowerPC architectures, on the AIX, Linux, and MacOS/X operating systems.  Licensed under the CPL (Common PublicLicense).  Extensively documented.  Actively developed as of June,2004.@end itemizeIn the past integration efforts were focused mainly on Japhar with an eyetowards getting Electrical Fire to work.  Most information contained inthis document is gleaned from these efforts. Recently more work has beendone on getting gcj, orp and kissme to work out of the box with GNU Classpathbut there is much to do before that becomes a reality.@node Initialization, Classpath Hooks, Introduction, Top@comment node-name, next, previous, up@chapter InitializationThe order of initialization, as far as I can tell, doesn't matter justyet.  However, when we move to 1.2 support, it probably will matter, sowe'll have a note in here at that time.The initialization order is currently documented in the@file{Runtime.java} source file.@node Classpath Hooks, VM Hooks, Initialization, Top@comment node-name, next, previous, up@chapter Classpath HooksThe primary method of interaction between Classpath and the VM is viathe helper classes, which are named after the relevant core libraryclass, but include an additional `VM' prefix.  The library classes fromClasspath call out to these to get certain VM-specific dirty work done.A reference copy of each VM class exists.  The majority consist of aseries of static methods, some of which are simply declared@code{native}, and some which provide a default implementation.  VMs mayeither use these as is, or create their own local variations.  Whenusing the default implementations, the VM is responsible forimplementing any of the code marked as @code{native} which correspondsto functionality they wish their VM to provide.  When using their ownversions of the classes, VM implementors may choose to change the mix ofnative and non-native methods from that below, so as to best suit theirimplementation.@menu* java.lang::* gnu.classpath::* java.util::* java.io::* java.security::* java.net::* java.nio::* java.nio.channels::* gnu.java.nio::* java.lang.reflect::* Classpath Callbacks::@end menu@node java.lang, gnu.classpath, Classpath Hooks, Classpath Hooks@comment  node-name,  next,  previous,  up@section @code{java.lang}@code{java.lang} is the core Java package, being imported automatically by allclasses.  It includes basic classes as @code{Object} and @code{String}.A VM must implement at least some parts of this package in order tobecome operable.@menu* java.lang.VMClass::* java.lang.VMObject::* java.lang.VMClassLoader::* java.lang.VMSystem::* java.lang.VMThrowable::* java.lang.VMCompiler::* java.lang.VMDouble::* java.lang.VMFloat::* java.lang.VMProcess::* java.lang.VMRuntime::* java.lang.VMString::* java.lang.VMThread::* java.lang.VMInstrumentationImpl::* java.lang.VMMath::@end menu@node java.lang.VMClass, java.lang.VMObject ,java.lang,java.lang@subsection @code{java.lang.VMClass}The core class, @code{java.lang.Class}, and the corresponding VM class,@code{java.lang.VMClass}, provide two main functions within GNU Classpath.@enumerate@item For basic VM operation, @code{java.lang.Class} provides the link betweenthe Java-based representation of a class it embodies and the VM's owninternal structure for a class.  @xref{VM Hooks}.@item As far as the user is concerned, the main function of@code{java.lang.Class} is as an entry point to the reflectionfacilities, and so it also provides this functionality, backed by theVM class.@end enumerateThis VM class lists the following methods, organized by the version of theJava specification in which they occur.  All are @code{native}, unlessotherwise specified, and pertain to reflection.  As a result, the VM onlyneeds to implement these methods in order to provide reflection support,and then only to the degree required.@itemize @bullet@item 1.0@itemize @bullet@item @code{isInterface(Class)} -- This is simply a property test, and matchesthe presence of an appropriate flag within the class file.@item @code{getName(Class)} -- Returns the fully-qualified name of the class.@item @code{getSuperclass(Class)} -- Returns a @code{Class} instance whichrepresents the superclass.  Again, the class file contains an element directlyrelating to this.  @code{null} is returned for primitives, interfaces and@code{Object}.@item @code{getInterfaces(Class)} -- Same as the above, but the implementedor extended interfaces rather than the superclass.  An empty array shouldbe returned, rather than @code{null}.@item @code{getDeclaredClasses(Class,boolean)} -- Returns the internal classesthis instance declares directly.  The flag determines whether or not theVM should filter out non-public classes.@item @code{getDeclaredFields(Class,boolean)} -- The same for fields.@item @code{getDeclaredMethods(Class,boolean)} -- And for methods.@item @code{getDeclaredConstructors(Class,boolean)} -- And constructors.@item @code{getClassLoader(Class)} -- Returns the @code{ClassLoader} instancewhich is responsible for the specified class.@item @code{forName(String)} -- The VM should create a @code{Class} instancecorresponding to the named class.  As noted in @ref{VM Hooks}, the internalcontent of the instance is the responsibility of the VM.@item @code{isArray(Class)} -- Another property test, corresponding to aclass file flag.@item @code{initialize(Class)} -- The VM should initialize the class fully,if it has not already done so.@item @code{loadArrayClass(String,ClassLoader)} -- This is called if

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -