vmOperations.hpp

Go to the documentation of this file.
00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.29 */
00002 /* Copyright (c) 2006, Sun Microsystems, Inc.
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 
00006 following conditions are met:
00007 
00008     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 
00010           disclaimer in the documentation and/or other materials provided with the distribution.
00011     * Neither the name of Sun Microsystems nor the names of its contributors may be used to endorse or promote products derived 
00012           from this software without specific prior written permission.
00013 
00014 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 
00015 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
00016 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00017 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00018 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
00019 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00020 
00021 
00022 */
00023 
00024 // The following classes are used for operations
00025 // initiated by a delta process but must
00026 // take place in the vmProcess.
00027 
00028 class VM_Operation : public PrintableStackObj {
00029  private:
00030    DeltaProcess* _calling_process;
00031  public:
00032    void set_calling_process(DeltaProcess* p) { _calling_process = p; }
00033    DeltaProcess* calling_process() const { return _calling_process; }
00034 
00035    virtual bool is_scavenge()        const { return false; }
00036    virtual bool is_garbage_collect() const { return false; }
00037    virtual bool is_single_step()     const { return false; }
00038 
00039    void evaluate();
00040    // Evaluate is called in the vmProcess
00041    virtual void doit() = 0;
00042    void print() { std->print("%s", name()); }
00043 
00044    virtual char* name() { return "vanilla"; }
00045 };
00046 
00047 class VM_Scavenge : public VM_Operation {
00048  private:
00049   oop* addr;
00050  public:
00051   bool is_scavenge() const      { return true; }
00052   VM_Scavenge(oop* addr)        { this->addr = addr; }
00053   void doit();
00054 
00055   char* name() { return "scavenge"; }
00056 };
00057 
00058 class VM_Genesis : public VM_Operation {
00059  public:
00060   VM_Genesis();
00061   void doit();
00062 
00063   char* name() { return "genesis"; }
00064 };
00065 
00066 class VM_GarbageCollect : public VM_Operation {
00067  private:
00068   oop* addr;
00069  public:
00070   bool is_garbage_collect() const       { return true; }
00071   VM_GarbageCollect(oop* addr)          { this->addr = addr; }
00072   void doit();
00073 
00074   char* name() { return "terminate process"; }
00075 };
00076 
00077 class VM_TerminateProcess : public VM_Operation {
00078  private:
00079   DeltaProcess* target;
00080  public:
00081   VM_TerminateProcess(DeltaProcess* target) { this->target = target; }
00082   void doit();
00083 
00084   char* name() { return "terminate process"; }
00085 };
00086 
00087 
00088 class VM_DeoptimizeStacks : public VM_Operation {
00089  public:
00090   void doit();
00091 
00092   char* name() { return "deoptimize stacks"; }
00093 };
00094 
00095 # ifdef DELTA_COMPILER
00096 
00097 class VM_OptimizeMethod : public VM_Operation {
00098  private:
00099   LookupKey _key;
00100   methodOop _method;
00101   nmethod*  _nm;
00102  public:
00103   VM_OptimizeMethod(LookupKey* key, methodOop method) : _key(key) {
00104     _method = method;
00105   }
00106   nmethod* result() const       { return _nm; }
00107   void doit();
00108 
00109   char* name() { return "optimize method"; }
00110 };
00111 
00112 class VM_OptimizeRScope : public VM_Operation {
00113  private:
00114   RScope*   _scope;
00115   nmethod*  _nm;
00116  public:
00117   VM_OptimizeRScope(RScope* scope) {
00118     _scope = scope;
00119   }
00120   nmethod* result() const       { return _nm; }
00121   void doit();
00122 
00123   char* name() { return "optimize rscope"; }
00124 };
00125 
00126 class VM_OptimizeBlockMethod : public VM_Operation {
00127  private:
00128   blockClosureOop           closure;
00129   NonInlinedBlockScopeDesc* scope;
00130   nmethod*                  nm;
00131  public:
00132   VM_OptimizeBlockMethod(blockClosureOop closure, NonInlinedBlockScopeDesc* scope) {
00133     this->closure   = closure;
00134     this->scope     = scope;
00135   }
00136   void doit();
00137   nmethod* method() const       { return nm; }
00138 
00139   char* name() { return "optimize block method"; }
00140 };
00141 
00142 # endif

Generated on Mon Oct 9 13:37:30 2006 for Strongtalk VM by  doxygen 1.4.7