Index: include/apr_thread_ext.h =================================================================== --- include/apr_thread_ext.h (revision 487512) +++ include/apr_thread_ext.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Andrey Chernyshev - * @version $Revision$ - */ #ifndef APR_EXT_H Index: include/clog.h =================================================================== --- include/clog.h (revision 487512) +++ include/clog.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Roman S. Bushmanov -* @version $Revision: 1.1.2.1.4.3 $ -*/ #ifndef _C_LOG_H_ #define _C_LOG_H_ Index: include/cxxlog.h =================================================================== --- include/cxxlog.h (revision 487512) +++ include/cxxlog.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Alexey V. Varlamov, Evgueni Brevnov - * @version $Revision: 1.1.2.2.4.4 $ - */ + #ifndef _CXX_LOG_H_ #define _CXX_LOG_H_ Index: include/lil.h =================================================================== --- include/lil.h (revision 487512) +++ include/lil.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,12 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov, Ivan Volosyuk - * @version $Revision: 1.1.2.1.4.4 $ - */ - #ifndef _LIL_H_ #define _LIL_H_ @@ -29,218 +24,285 @@ #include "tl/memory_pool.h" #include "m2n.h" -/* This file describes LIL - the architecture-independent language used to generate code stubs etc. +/** + * @file This file describes LIL - the architecture-independent language used to + * generate code stubs etc. + * + * Goals: + * + * + * Design constaints: + * + * + * The basic unit of LIL is a code stub. It is intended to be the entry point + * of a function that can be called by managed or native code, and executes in + * the presence of an activation frame. The frame consists of up to six parts: + * inputs, standard places, an m2n frame, locals, outputs, and a return variable. + * Which parts are present in the activation frame, and how big each part is, can + * vary across points in the code stub. + * + * A LIL code stub is an entry and a sequence of statements. The entry specifies + * the inputs and their types, the number of standard places, the type of the + * return, and the calling convention (which determines where the inputs, + * return address, and return goes, which registers are caller save vs callee save, + * and who pops the inputs; standard places are determined by LIL and the platform, + * and are intended for trampolines). An entry can have an "arbitrary" + * signature, meaning that the number and type of inputs and type of return is + * unknown (the stub must work for all possibilities). After entry the declared + * number of input variables are available, the declared number of standard + * places are available, there is no m2n frame, there are no locals, there are no + * outputs, and there is no return variable. + *
+ * cs ::= entry i:cc:sig; ss
+ * ss ::= s | s ss
+ * 
+ * The statements are: + *
+ * s ::= :l;
+ * |  locals i;
+ * |  std_places i;
+ * |  alloc v,i;
+ * |  v=uop o;
+ * |  v=o op o;
+ * |  v=o;
+ * |  v=ts;
+ * |  handles=o;
+ * |  ld v,addr(,zx|,sx)?;
+ * |  st addr,o;
+ * |  inc addr;
+ * |  cas addr=o,o,l;
+ * |  j l;
+ * |  jc cond,l;
+ * |  out cc:sig;
+ * |  in2out cc:RT;
+ * |  calli o;
+ * |  ret; 
+ * |  push_m2n i oh;
+ * |  m2n_save_all;
+ * |  pop_m2n;
+ * |  print str, o;
+ *
+ * uop ::= neg | not | sx1 | sx2 | sx4 | zx1 | zx2 | zx4 | ...
+ * op ::= + | - | * | & | << | ...
+ *
+ * addr ::= [ov osv i :T ackrel]
+ * ov ::= | v+
+ * osv ::= | 1*v+ | 2*v+ | 4*v+ | 8*v+
+ * acqrel ::= | ,acquire | ,release
+ *
+ * cond ::= v=0 | v!=0 | o=o | o!=o | o
+ *
+ * platform = default calling convention used by VM
+ * jni      = calling convention used by JNI
+ * managed  = calling convention used by jitted code
+ * rth      = calling convention used to call runtime helpers
+ * stdcall  = Windows's stdcall calling convention
+ *
+ * 20021204: The rth calling convention should be used for all runtime helpers.  
+ *           Unfortunately, on IA32 we are inconsistent in the calling
+ *           conventions used to call runtime helpers - some use stdcall, some 
+ *           use the managed code conventions. So for now, rth is to be
+ *           used for stdcall helpers, managed should be used for the rest.  
+ *           In the future we can harmonise this and correct the problem.
+ *
+ * l is a label (sequence of alpha, digit, _, starting with alpha or _)
+ * v is a variable, one of: i0, i1, ... (input variables), sp0, sp1, ... (standard places), 
+ * l0, l1, ... (local variables),
+ * o0, o1, ... (output variables), r (return variable)
+ * i is an immediate (sequence of digits, or 0x hex digits)
+ * str is either a string enclosed in single quotes, or a number denoting an address
+ *
+ * Operand semantics:
+ *
+ * An operand with a v stands for that variable; an operand with an i stands for 
+ * that immediate; an operand with an optional :t is cast to the
+ * type t (ie it has type t). Only certain casts are allowed by the verifier: 
+ * the types ref, pint, and g4/g8 (depending upon architecture) are
+ * castable to each other. Note that casting refs to/from the other types may be 
+ * GC unsafe.
+ *
+ * Statement semantics:
+ *
+ * :l declares a label l. A LIL code stub is not valid if such a label merges 
+ * control flow with inconsistent activation frames. Specifically, the number 
+ * and types of inputs must be the same (currently there is no way they
+ * could not be), only the minimum of the number of standard places will be 
+ * available after the statement, the m2n frame must either be present in 
+ * all incoming edges or absent in all incoming edges, the number of locals 
+ * must be the same, the number of outputs must be the same, and
+ * the return variable will be defined after the statement only if it is 
+ * defined on all incoming edges.
+ *
+ * locals i makes i locals available in the activation frame.  
+ * If there were locals available previously, they are lost.
+ * std_places i makes i standard places available in the activation frame.  
+ * If there were standard places available previously,
+ * they are lost.
+ *
+ * alloc v, i allocates i contigous bytes of space whose lifetime is up to the 
+ * next ret, tailcall, or pop_m2n instruction.
+ * The address of this space is placed into v. The space will not be moved for 
+ * any reason. The amount of space allocated by such instructions must
+ * be statically determinable for each code point in a code stub. This instruction 
+ * may not appear between out/in2out and call/call.noret/tailcall instructions.
+ *
+ * v=uop o evaluates o to a value, performs unary operation uop on it, and stores 
+ * the result in v. 
+ *
+ * v=o1 op o2 evaluates o1 & o2 to values, performs binary operation op on them, 
+ * and stores the result in v.
+ *
+ * v=ts places a pointer to the current thread's thread structure into v.
+ *
+ * handles=o evaluates o to a value and sets the handles pointer in the m2n frame 
+ * to this value. This instruction must be dominated by a push_m2n handles 
+ * instruction.
+ *
+ * ld v,addr evaluates addr to an address (see below) and loads the value 
+ * (of type given in addr) at this address into v. If ,zx appears at the end then the 
+ * value is zero extended into v, which gets type pint; if ,sx appears at the end then 
+ * the value is sign extended into v, which gets pint; otherwise, v gets the same type as 
+ * in addr.
+ *
+ * st addr,o evaluates addr to an address (see below) o to a value and stores the 
+ * value into the contents (of type given in addr) at the address.
+ *
+ * inc addr evaluates addr to an address (ses below) and increments the value 
+ * (of type given in addr) at this address.
+ *
+ * cas addr=o1,o2,l evaluates addr to an address (see below) a, o1 to a value v1, and 
+ * o2 to a value v2. Then it atomically: compares the value (of type gien in addr) 
+ * to o1 and if equal swaps the contents of a with o2. If the match fails then it 
+ * jumps to label l.
+ *
+ * ov+osv+i:T acqrel evaluates to (0 | contents of v) + (0 | 1 * contents of v
+ * | 2 * contents of v | 4 * contents of v | * 8 * contents of v) + i. 
+ * Further if acqrel is acquire then the operation in which it appears has 
+ * acquire semantics, and if it is release then the operation in which it 
+ * appears has release semantics.
+ *
+ * j l jumps to label l. A LIL code stub is invalid if l is not a declared label 
+ * in the code stub.
+ * jc cond, l either continues with the next statement or jumps to label l, 
+ * depending upon the evaluation of cond. A LIL code stub is invalid if l 
+ * is not declared in the stub. The conditions are evaluated as follows.  
+ * v=0 will branch if v has value 0; v!=0 will branch if v does not have value 0; 
+ * o1=o2 will branch if o1 & o2 evaluate to the same value; o1!=o2
+ * will branch if o1 & o2 evaluate to different values; o1
+ * T ::= g1 | g2 | g4 | g8 | f4 | f8 | ref | pint
+ * RT ::= T | void
+ *
+ * sig ::= Ts:RT | arbitrary
+ * Ts ::= | T,Ts
+ * 
+ * + * The meaning of the types is: g1 means a one-byte general-purpose (ie not + * floating point) quantitiy, g2 means two-byte, g4 means 4-bytes, g8 menas + * eight-byte, f4 means a 4-byte floating-point quantity, f8 means 8-byte, + * ref means a pointer into the managed heap, pint means a platform-sized + * general-purpose quantity which might be an integer or an unmanaged pointer, + * void means there is nothing returned. + * + * The LIL syntax allows comments that start with // and go to the end of the line. + */ -Goals: -* Lightweight - i.e. small language, quality code generation possible with small simple algorithms -* Remove most architecture dependencies from code -* (Future) allow inlining of VM stubs into JITed code -* (Future) allow inlining of GC or Thread/Sync code via LIL -* (Possibly future) be the lowest ir of a simple JIT +/** + * @name Datatypes + */ +//@{ -Design constaints: -* Keep language syntax LL(1) so that parsing can be done with a recursive descent parser -* Make single-pass register allocation possible -* Allow easy experimentation with calling conventions - -The basic unit of LIL is a code stub. It is intended to be the entry point of a function that can be -called by managed or native code, and executes in the presence of an activation frame. The frame consists -of up to six parts: inputs, standard places, an m2n frame, locals, outputs, and a return variable. Which -parts are present in the activation frame, and how big each part is, can vary across points in the code stub. - -A LIL code stub is an entry and a sequence of statements. The entry specifies the inputs and their types, the -number of standard places, the type of the return, and the calling convention (which determines where the inputs, -return address, and return goes, which registers are caller save vs callee save, and who pops the inputs; standard -places are determined by LIL and the platform, and are intended for trampolines). An entry can have an "arbitrary" -signature, meaning that the number and type of inputs and type of return is unknown (the stub must work for all -possibilities). After entry the declared number -of input variables are available, the declared number of standard places are available, there is no m2n frame, -there are no locals, there are no outputs, and there is no return variable. - -cs ::= entry i:cc:sig; ss -ss ::= s | s ss - -The statements are: - -s ::= :l; -| locals i; -| std_places i; -| alloc v,i; -| v=uop o; -| v=o op o; -| v=o; -| v=ts; -| handles=o; -| ld v,addr(,zx|,sx)?; -| st addr,o; -| inc addr; -| cas addr=o,o,l; -| j l; -| jc cond,l; -| out cc:sig; -| in2out cc:RT; -| calli o; -| ret; -| push_m2n i oh; -| m2n_save_all; -| pop_m2n; -| print str, o; - -uop ::= neg | not | sx1 | sx2 | sx4 | zx1 | zx2 | zx4 | ... -op ::= + | - | * | & | << | ... - -addr ::= [ov osv i :T ackrel] -ov ::= | v+ -osv ::= | 1*v+ | 2*v+ | 4*v+ | 8*v+ -acqrel ::= | ,acquire | ,release - -cond ::= v=0 | v!=0 | o=o | o!=o | o + *
  • i in an immediate, takes the next argument as a pointer-size + * int (int on IA32, long long on IPF) as the value of the immediate
  • + *
  • i in a variable, takes the next argument as a platform int + * as the index (not valid for ret)
  • + *
  • m in a signature, takes the next argument as a + * Method_Handle and constructs the standard managed signature + * for it
  • + *
  • j in a signature, takes the next argument as a + * Method_Handle and constructs the standard JNI signature for it
  • + * + * + * % may also be used in a label to get generated labels, there are + * no numbers, but the specifiers are: + * + * + * @return NULL on parsing error + */ LilCodeStub* lil_parse_code_stub(const char* src, ...); -// Parse a string as a sequence of instructions and add them to the end of the input code stub. -// The % syntax above can be used. -// Return NULL on parsing error and the input is freed, otherwise the return is the same as the parameter. -LilCodeStub* lil_parse_onto_end(LilCodeStub*, const char* src, ...); -//*** Instruction Contexts +/** + * Parse a string as a sequence of instructions and add them to the end of the + * input code stub. + * The % syntax above can be used. + * + * @return NULL on parsing error and the input is freed, otherwise + * the return is the same as the parameter. + */ + LilCodeStub* lil_parse_onto_end(LilCodeStub*, const char* src, ...); +//@} +/** @name Instruction Contexts + */ +//@{ + enum LilM2nState { LMS_NoM2n, LMS_NoHandles, LMS_Handles }; struct LilInstructionContext; @@ -319,183 +409,290 @@ VMEXPORT LilType lil_ic_get_type(LilCodeStub*, LilInstructionContext*, LilOperand*); -// returns the type of an instruction's destination variable _after_ the -// instruction is performed. -// If the instruction has no destination, LT_Void is returned. -// Notice that this type may be different than the type returned by -// lil_ic_get_type for the destination variable, since the latter -// refers to the situation _before_ the instruction. -VMEXPORT LilType lil_instruction_get_dest_type(LilCodeStub*, LilInstruction*, +/** + * Returns the type of an instruction's destination variable _after_ + * the instruction is performed. + * If the instruction has no destination, LT_Void is returned. + * Notice that this type may be different than the type returned by + * lil_ic_get_type for the destination variable, since the latter + * refers to the situation _before_ the instruction. + */ + VMEXPORT LilType lil_instruction_get_dest_type(LilCodeStub*, LilInstruction*, LilInstructionContext*); - -//*** Interogators - -// Is a LIL code stub valid? +//@} +/** @name Interogators + */ +//@{ + +/////// Is a LIL code stub valid? + VMEXPORT bool lil_is_valid(LilCodeStub* cs); -// Return a code stubs entry signature +/** + * Return a code stubs entry signature + */ VMEXPORT LilSig* lil_cs_get_sig(LilCodeStub* cs); -// Return the number of instructions in a code stub -VMEXPORT unsigned lil_cs_get_num_instructions(LilCodeStub* cs); +/** + * Return the number of instructions in a code stub + */ + VMEXPORT unsigned lil_cs_get_num_instructions(LilCodeStub* cs); -// Return the number of BBs in a code stub -VMEXPORT unsigned lil_cs_get_num_BBs(LilCodeStub *cs); +/** + * Return the number of BBs in a code stub. + */ + VMEXPORT unsigned lil_cs_get_num_BBs(LilCodeStub *cs); -// Return the first BB in the stub (from that one can get all BBs using get_next() -VMEXPORT LilBb* lil_cs_get_entry_BB(LilCodeStub* cs); +/** + * Return the first BB in the stub (from that one can get all BBs using + * get_next(). + */ + VMEXPORT LilBb* lil_cs_get_entry_BB(LilCodeStub* cs); -// Compute the contexts of each instruction in the code stub -// This function must be called to use instruction iterators that track contexts -VMEXPORT void lil_compute_contexts(LilCodeStub* cs); +/** + * Compute the contexts of each instruction in the code stub + * This function must be called to use instruction iterators that track contexts. + */ + VMEXPORT void lil_compute_contexts(LilCodeStub* cs); -// Return maximum number of std places used in the stub -VMEXPORT unsigned lil_cs_get_max_std_places(LilCodeStub * cs); +/** + * Return maximum number of std places used in the stub. + */ + VMEXPORT unsigned lil_cs_get_max_std_places(LilCodeStub * cs); -// Return maximum number of locals used in the stub -VMEXPORT unsigned lil_cs_get_max_locals(LilCodeStub * cs); +/** + * Return maximum number of locals used in the stub. + */ + VMEXPORT unsigned lil_cs_get_max_locals(LilCodeStub * cs); -// Return size of generated code -VMEXPORT void lil_cs_set_code_size(LilCodeStub * cs, size_t size); +/** + * Return size of generated code. + */ + VMEXPORT void lil_cs_set_code_size(LilCodeStub * cs, size_t size); -// Return size of generated code +/** + * Return size of generated code. + */ VMEXPORT size_t lil_cs_get_code_size(LilCodeStub * cs); -// totally artificial limit; increase if needed -// the max number of predecessors any BB may have -#define MAX_BB_PRED 10 +/** + * Totally artificial limit; increase if needed + * the max number of predecessors any BB may have + */ + #define MAX_BB_PRED 10 class LilBb { private: - // the code stub +//@} +/** @name The Code Stub + */ +//@{ + LilCodeStub *cs; - // since bb code will appear consecutively in the stub, - // all we need is the first and last instruction - LilInstruction *start; + /** + * Since BB code will appear consecutively in the stub, + * all we need is the first and last instruction + */ + LilInstruction *start; LilInstruction *end; // if end is NULL, the end of the stub is implied - // the LIL context right before the first instruction of the BB - LilInstructionContext* ctxt; + /** + * The LIL context right before the first instruction of the BB. + */ + LilInstructionContext* ctxt; - // successors of this BB in the flowgraph - LilBb* fallthru; + /** + * Successors of this BB in the flowgraph. + */ + LilBb* fallthru; LilBb* branch_target; - // predecessors of this BB in the flowgraph - unsigned num_pred; - LilBb *pred[MAX_BB_PRED]; - // for forming BB lists + /** Predecessors of this BB in the flowgraph + *unsigned num_pred; + */ + LilBB *pred[MAX_BB_PRED]; + /** + * For forming BB lists + */ LilBb* next; - // ID; within each stub, IDs will be unique and go from 0 to -1 - int id; - // private constructor; create BBs by calling init_fg() + /** + * ID; within each stub, IDs will be unique and go from 0 to -1 + */ + int id; + /** Private constructor; create BBs by calling init_fg() + */ LilBb(LilCodeStub *_cs, LilInstruction *_start, LilInstructionContext* ctxt_at_start); - // private operator new; create BBs using new_bb() only - void* operator new(size_t sz, tl::MemoryPool& m); - //MVM - //add empty destructor to avoid warning - void operator delete(void * UNREF obj, tl::MemoryPool& UNREF m){ - //do nothing + /** + * Private operator new; create BBs using new_bb() only + */ + void* operator new(size_t sz, tl::MemoryPool& m); + /** + * MVM + * add empty destructor to avoid warning + */ + void operator delete(void * UNREF obj, tl::MemoryPool& UNREF m){ + /** + * Do nothing + */ }; public: - // the only way to create new BBs; create a whole FG for a stub - VMEXPORT static void init_fg(LilCodeStub*); + /** + * The only way to create new BBs; create a whole FG for a stub + */ + VMEXPORT static void init_fg(LilCodeStub*); - // sets the last instruction of the BB + /** + * Sets the last instruction of the BB + */ VMEXPORT void set_last(LilInstruction *i); - // gets the first instruction + /** + * Gets the first instruction + */ VMEXPORT LilInstruction* get_first(); - // gets the last instruction + /** + * Gets the last instruction + */ VMEXPORT LilInstruction* get_last(); - // get the context right before the start of the BB - VMEXPORT LilInstructionContext* get_context(); + /** + * Get the context right before the start of the BB + */ + VMEXPORT LilInstructionContext* get_context(); - // does this bb contain instruction i? + //// Does this BB contain instruction i? + VMEXPORT bool contains(LilInstruction *i); - // get the label of this BB; NULL if no label exists - VMEXPORT LilLabel get_label(); + /** + * Get the label of this BB; NULL if no label exists + */ + VMEXPORT LilLabel get_label(); - // set a fallthrough successor to this bb - VMEXPORT void set_fallthru(LilBb *); - // set a branch-target successor to this bb - VMEXPORT void set_branch_target(LilBb *); + /** + * Set a fallthrough successor to this BB + */ + VMEXPORT void set_fallthru(LilBb *); + /** + * Set a branch-target successor to this BB + */ + VMEXPORT void set_branch_target(LilBb *); - // get the fallthrough and branch target successors; - // either of them can be NULL if they don't exist - VMEXPORT LilBb* get_fallthru(); + /** + * Get the fallthrough and branch target successors; + * either of them can be NULL if they don't exist + */ + VMEXPORT LilBb* get_fallthru(); VMEXPORT LilBb* get_branch_target(); - // gets the i'th predecessor (NULL if i >= num_pred) - VMEXPORT LilBb *get_pred(unsigned i); + /** + * Gets the i'th predecessor (NULL if i >= num_pred) + */ + VMEXPORT LilBb *get_pred(unsigned i); - // gets the next BB in the list - VMEXPORT LilBb *get_next(); + /** + * Gets the next BB in the list + */ + VMEXPORT LilBb *get_next(); - // returns whether this BB ends in a return instruction - // (tailcall implies return!) - VMEXPORT bool is_ret(); + /** + * Returns whether this BB ends in a return instruction + * (tailcall implies return!) + */ + VMEXPORT bool is_ret(); - // the id of this BB + /** + * The id of this BB + */ VMEXPORT int get_id(); - // true if this BB contains calls (which means it may throw exceptions) + /** + * TRUE if this BB contains calls (which means it may throw + * exceptions) + */ VMEXPORT bool does_calls(); - // true if this BB ends with a call.noret (which means it is probably cold code) + /** + * TRUE if this BB ends with a call.noret (which means it + * is probably cold code) + */ VMEXPORT bool does_call_noret(); - // find a BB with the specified label; NULL if no such bb exists + /** + * Find a BB with the specified label; NULL if no such BB exists + */ VMEXPORT static LilBb* get_by_label(LilCodeStub *cs, LilLabel l); - // find a BB which contains the specified instruction; NULL if no such BB exists + /** + * Find a BB which contains the specified instruction; NULL if + * no such BB exists + */ VMEXPORT static LilBb* get_by_instruction(LilCodeStub *cs, LilInstruction *i); - // print a BB to a stream (does not print the BB's instructions) - VMEXPORT void print(FILE* out); + /** + * Print a BB to a stream (does not print the BB's instructions) + */ + VMEXPORT void print(FILE* out); }; -// Iterate over the instructions in a code stub +/** + * Iterate over the instructions in a code stub. + */ class LilInstructionIterator { public: - // Create an iterator from a code stub, if track_contexts then track the context prior to each instruction + /** + * Create an iterator from a code stub, if track_contexts + * then track the context prior to each instruction + */ VMEXPORT LilInstructionIterator(LilCodeStub*, bool track_contexts); - // Create an iterator for a BB in a code stub. - // NOTE: track_contexts is currently NOT supported for this type of iterator + /** + * Create an iterator for a BB in a code stub. + * + * @note track_contexts is currently NOT supported for this + * type of iterator + */ VMEXPORT LilInstructionIterator(LilCodeStub*, LilBb*, bool track_contexts); - // Is iterator past the end of the instructions? - VMEXPORT bool at_end(); - // Return current instruction + ////// Is iterator past the end of the instructions? + + VMEXPORT bool at_end(); + /** + * Return current instruction + */ VMEXPORT LilInstruction* get_current(); - // Return context prior to current instruction, must have created iterator to track contexts - VMEXPORT LilInstructionContext* get_context(); - // Goto the next instruction + /** + * Return context prior to current instruction, must have created iterator + * to track contexts. + */ + VMEXPORT LilInstructionContext* get_context(); + /** + * Goto the next instruction + */ VMEXPORT void goto_next(); private: LilCodeStub* cs; - LilBb *bb; // NULL, unless this is an iterator for a BB + LilBb *bb; // NULL, unless this is an iterator for a BB LilInstruction* cur; bool track_ctxt; LilInstructionContext* ctxt; }; +//@} +/** @name Visitor pattern for instructions + */ +//@{ - -// Visitor pattern for instructions class LilInstructionVisitor { protected: VMEXPORT LilInstructionVisitor(); @@ -526,9 +723,11 @@ }; -// LilInstructionVisitor_Default provides empty implementations for the -// abstract functions in LilInstructionVisitor. It is a convenient base -// class for scanners that need to act only on a few instructions. +/** + * LilInstructionVisitor_Default provides empty implementations for the + * abstract functions in LilInstructionVisitor. It is a convenient base + * class for scanners that need to act only on a few instructions. + */ class LilInstructionVisitor_Default : public LilInstructionVisitor { protected: LilInstructionVisitor_Default(): @@ -560,63 +759,106 @@ }; -// Visit instruction using a visitor +/** + * Visit instruction using a visitor + */ VMEXPORT void lil_visit_instruction(LilInstruction*, LilInstructionVisitor*); -// Return variable's kind +/** + * Return variable's kind + */ VMEXPORT LilVariableKind lil_variable_get_kind(LilVariable* v); -// Return variable's index +/** + * Return variable's index + */ VMEXPORT unsigned lil_variable_get_index(LilVariable* v); -// Are two variables the same + +///// Are two variables the same + VMEXPORT bool lil_variable_is_equal(LilVariable* v1, LilVariable* v2); -// Is operand an immediate? +////// Is operand an immediate? VMEXPORT bool lil_operand_is_immed(LilOperand* o); -// If operand is an immediate return the immediate value +/** + * If operand is an immediate return the immediate value + */ VMEXPORT POINTER_SIZE_INT lil_operand_get_immed(LilOperand* o); -// If operand is not an immediate return the variable it represents +/** + * If operand is not an immediate return the variable it represents + */ VMEXPORT LilVariable* lil_operand_get_variable(LilOperand* o); -// Return a signature's calling convention +/** + * Return a signature's calling convention + */ VMEXPORT LilCc lil_sig_get_cc(LilSig* sig); -// Return whether this signature is arbitrary +/** + * Return whether this signature is arbitrary + */ VMEXPORT bool lil_sig_is_arbitrary(LilSig *sig); -// Return the number of arguments for a signature (0 if arbitrary) +/** + * Return the number of arguments for a signature (0 if arbitrary) + */ VMEXPORT unsigned lil_sig_get_num_args(LilSig* sig); -// Return the num-th argument type of a signature (zero based) (undefined if signature is arbitrary) +/** + * Return the num-th argument type of a signature (zero based) + * (undefined if signature is arbitrary) + */ VMEXPORT LilType lil_sig_get_arg_type(LilSig* sig, unsigned num); -// Return the return type of a signature +/** + * Return the return type of a signature + */ VMEXPORT LilType lil_sig_get_ret_type(LilSig* sig); -// Is an operation binary? +///// Is an operation binary? VMEXPORT bool lil_operation_is_binary(enum LilOperation op); -// Is a predicate binary? +////// Is a predicate binary? VMEXPORT bool lil_predicate_is_binary(enum LilPredicate c); -// Is a predicate signed? +////// Is a predicate signed? VMEXPORT bool lil_predicate_is_signed(LilPredicate c); -//*** Printers +//@} +/** @name Printers + */ +//@{ -// Print a type to a stream +/** + * Print a type to a stream + */ VMEXPORT void lil_print_type(FILE*, LilType); -// Print a signature to a stream +/** + * Print a signature to a stream + */ VMEXPORT void lil_print_sig(FILE*, LilSig*); -// Print an instruction to a stream +/** + * Print an instruction to a stream + */ VMEXPORT void lil_print_instruction(FILE*, LilInstruction* i); -// Print a code stub to a stream +/** + * Print a code stub to a stream + */ VMEXPORT void lil_print_code_stub(FILE*, LilCodeStub* cs); -// Print just the entry of a code stub to a stream +/** + * Print just the entry of a code stub to a stream + */ VMEXPORT void lil_print_entry(FILE*, LilCodeStub* cs); -//*** Freers +//@} +/** @name Freers + */ +//@{ -// Return all resources associated with a code stub -// Post: code stub no longer usable +/** + * Return all resources associated with a code stub + * Post: code stub no longer usable + */ VMEXPORT void lil_free_code_stub(LilCodeStub* cs); -//*** Function pointer utilities - +//@} +/** @name Function pointer utilities + */ +//@{ VMEXPORT GenericFunctionPointer lil_npc_to_fp(NativeCodePtr); #endif // _LIL_H_ Index: include/lil_code_generator.h =================================================================== --- include/lil_code_generator.h (revision 487512) +++ include/lil_code_generator.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,12 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov, Ivan Volosyuk - * @version $Revision: 1.1.2.1.4.4 $ - */ - #ifndef _LIL_CODE_GENERATOR_H_ #define _LIL_CODE_GENERATOR_H_ @@ -28,42 +23,52 @@ #include "environment.h" #include "mem_alloc.h" -// This is an abstract base case for LIL code generators -// Subclasses compile LIL into native code for a particular -// architecture +/** + * This is an abstract base case for LIL code generators + * Subclasses compile LIL into native code for a particular + * architecture. + * + * @note This is a compiler algorithm abstraction not a compilation process + * abstraction. Subclasses should not store state about any particular + * compilation, only options that configure the compilation. + */ -// Note that this is a compiler algorithm abstraction not -// a compilation process abstraction. Subclasses should -// not store state about any particular compilation, only -// options that configure the compilation. - class LilCodeGenerator { public: - // Return the code generator for the current platform + /** + * @return The code generator for the current platform + */ static LilCodeGenerator* get_platform(); - // Compile LIL code stub to native code and return it - // The stub_name is for vtune support - // Dump an ascii version of the compiled stub to stdout if dump_stub - // If cs_stats is nonnull add the number of bytes of the compiled code to *cs_stats + /** + * Compile LIL code stub to native code and return it + * The stub_name is for vtune support + * Dump an ascii version of the compiled stub to stdout if dump_stub + * If cs_stats is nonnull add the number of bytes of the compiled + * code to *cs_stats + */ NativeCodePtr compile(LilCodeStub* cs, PoolManager* code_pool = VM_Global_State::loader_env->GlobalCodeMemoryManager); protected: LilCodeGenerator(); - // allocates a chunk of memory for a LIL stub; the user-provided function - // compile_main() should call this function instead of allocating memory - // directly. + /** + * Allocates a chunk of memory for a LIL stub; the user-provided function + * compile_main() should call this function instead of allocating + * memory directly. + */ NativeCodePtr allocate_memory(size_t, PoolManager*); - // generates compiled code for a LIL stub, and returns its address. The - // size of the compiled stub is placed in stub_size. Called by the - // compile() function to do most of the work. - // - // Each subclass of LilCodeGenerator should provide a platform-dependent - // implementation of compile_main(). The memory area that holds the - // compiled code should be allocated by calling allocate_memory(). + /** + * Generates compiled code for a LIL stub, and returns its address. + * The size of the compiled stub is placed in stub_size. + * Called by the compile() function to do most of the work. + * + * Each subclass of LilCodeGenerator should provide a platform-dependent + * implementation of compile_main(). The memory area that holds + * the compiled code should be allocated by calling allocate_memory(). + */ virtual NativeCodePtr compile_main(LilCodeStub* cs, size_t* stub_size, PoolManager* code_pool) = 0; }; Index: include/lil_code_generator_utils.h =================================================================== --- include/lil_code_generator_utils.h (revision 487512) +++ include/lil_code_generator_utils.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,24 +14,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov, Ivan Volosyuk - * @version $Revision: 1.1.2.1.4.4 $ - */ - #ifndef _LIL_CODE_GENERATOR_UTILS_H_ #define _LIL_CODE_GENERATOR_UTILS_H_ #include "lil.h" #include "vm_core_types.h" -// This module provides some common utilities for generating native code from LIL code stubs - -//*** The following is for managing label to address translation and back patching - -// Patch types have to be the union of the various cases of the various architectures, -// so unfortunately are somewhat platform specific. +/** + * This module provides some common utilities for generating native code from + * LIL code stubs + * + * The following is for managing label to address translation and back patching + * + * Patch types have to be the union of the various cases of the various + * architectures, so unfortunately are somewhat platform specific. + */ typedef enum LilCguPatchType { LPT_Rel8, LPT_Rel32, LPT_Abs32 } LilCguPatchType; @@ -51,27 +49,39 @@ }LilCguLabelAddress; -// This class mantains a mapping between labels and addresses, and ensures the references to -// labels eventually point to those labels. -// Clients should call define_label to set a label's address, and patch_to_label to ensure references -// correct point to a label; the class will make sure that a reference points to its label once both -// functions have been called. +/** + * This class mantains a mapping between labels and addresses, and ensures the + * references to labels eventually point to those labels. Clients should call + * define_label to set a label's address, and patch_to_label + * to ensure references correct point to a label; the class will make sure that + * a reference points to its label once both functions have been called. + */ class LilCguLabelAddresses { public: - // Create a label to address mapping with back patching + /** + * Create a label to address mapping with back patching + */ LilCguLabelAddresses(tl::MemoryPool*, char * b); - // + void change_base(char * new_base); - // Label l should have addres code + /** + * Label l should have addres code + */ void define_label(LilLabel l, void * code, bool base_relative); - // The contents of address patch_address should point to label l according to patch_type + /** + * The contents of address patch_address should point to label l according to patch_type + */ void add_patch_to_label(LilLabel l, void * patch_address, LilCguPatchType patch_type); private: void add_new_label_adress(LilLabel l, void * code, bool base_relative); - // Apply all patches associated with the current label + /** + * Apply all patches associated with the current label + */ void apply_patches(LilCguLabelAddress * label_adress); - // Actually apply a patch + /** + * Actually apply a patch + */ void apply_patch(LilCguLabelAddress * label_adress, LilCguPatch * patch); LilCguLabelAddress * first; Index: include/log_macro.h =================================================================== --- include/log_macro.h (revision 487512) +++ include/log_macro.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Alexey V. Varlamov, Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.4 $ - */ + #ifndef _UTIL_LOG_MACRO_H #define _UTIL_LOG_MACRO_H @@ -34,8 +31,7 @@ /** * Macro expansion. It is used, for example, to combine - * a filename and a line number in - * __FILELINE__ macro. + * a filename and a line number in __FILELINE__ macro. */ #define EXPAND_(a) # a #define EXPAND(a) EXPAND_(a) Index: include/logger.h =================================================================== --- include/logger.h (revision 487512) +++ include/logger.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Roman S. Bushmanov, Dmitry B. Yershov -* @version $Revision: 1.1.2.2.4.3 $ -*/ #ifndef LOGGER_H #define LOGGER_H @@ -32,8 +28,8 @@ #endif /** - * Enum of logging levels - */ + * Enum of logging levels + */ typedef enum { DIE = 0, WARN, @@ -66,18 +62,18 @@ /** -* Inits log system. -*/ + * Inits log system. + */ VMEXPORT void init_log_system(); /** -* shutdown log system. -*/ + * Shutdown log system. + */ VMEXPORT void shutdown_log_system(); /** -* Sets loggers logging levels from file -*/ + * Sets loggers logging levels from file. + */ VMEXPORT void set_logging_level_from_file(const char* filename); /** * Passes the message specified with level assigned to the category specified for logging. @@ -117,9 +113,9 @@ VMEXPORT unsigned is_trace_enabled(const char *category, LogSite *site); /** -* Redirects category (and all subcategories) output to a file. -* If the file is NULL, removes previously assigned redirection (if any). -*/ + * Redirects category (and all subcategories) output to a file. + * If the file is NULL, removes previously assigned redirection (if any). + */ VMEXPORT void set_out(const char *category, const char* file); /** @@ -137,7 +133,7 @@ /** * Write formatted data to a newly allocated string. - * Use STD_FREE to release allocated memory. + * Use STD_FREE to release allocated memory. */ VMEXPORT const char* log_printf(const char* format, ...); Index: include/loggerstring.h =================================================================== --- include/loggerstring.h (revision 487512) +++ include/loggerstring.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Dmitry B. Yershov -* @version $Revision: 1.1.2.1.4.3 $ -*/ #ifndef LOGGER_STRING_H #define LOGGER_STRING_H Index: include/m2n.h =================================================================== --- include/m2n.h (revision 487512) +++ include/m2n.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov, Ivan Volosyuk - * @version $Revision: 1.1.2.1.4.4 $ - */ #ifndef _M2N_H_ #define _M2N_H_ @@ -26,19 +22,20 @@ #include "open/types.h" #include "vm_core_types.h" -// This module is for the "managed to native frame" abstraction, M2nFrame. -// An M2nFrame sits on the activation stack immediately above a managed -// frame and immediately below a native frame. All managed to native code -// transitions should involve pushing an M2nFrame with the following exceptions: -// Code that does not enable GC (note that calling managed code enables GC), -// throw exceptions, or inspects the stack does not need to push an M2nFrame. -// All other code must. -// M2nFrames are linked together in the order they are pushed onto the -// activation stack, and each thread has a pointer to the most recent M2nFrame. -// Each M2nFrame contains a list of local object handles, can identify the -// location of the return address into the managed frame that preceeds it, -// and is optionally associated with a native method. - +/** + * This module is for the "managed to native frame" abstraction, M2nFrame. + * An M2nFrame sits on the activation stack immediately above a managed + * frame and immediately below a native frame. All managed to native code + * transitions should involve pushing an M2nFrame with the following exceptions: + * Code that does not enable GC (note that calling managed code enables GC), + * throw exceptions, or inspects the stack does not need to push an M2nFrame. + * All other code must. + * M2nFrames are linked together in the order they are pushed onto the + * activation stack, and each thread has a pointer to the most recent M2nFrame. + * Each M2nFrame contains a list of local object handles, can identify the + * location of the return address into the managed frame that preceeds it, + * and is optionally associated with a native method. + */ struct M2nFrame; enum frame_type { @@ -59,95 +56,140 @@ FRAME_MODIFIED_STACK = 0x1000 }; -// The pushing and popping of native frames is done only by stubs that -// implement the managed to native transitions. These stubs use code that is -// necessarily architecture specific and some facilities that are not needed -// by other clients of this code, so this part of the interface is described -// elsewhere. +/** + * The pushing and popping of native frames is done only by stubs that + * implement the managed to native transitions. These stubs use code that is + * necessarily architecture specific and some facilities that are not needed + * by other clients of this code, so this part of the interface is described + * elsewhere. + * + * fill m2n frame as empty + */ + void m2n_null_init(M2nFrame *); -// fill m2n frame as empty -void m2n_null_init(M2nFrame *); - -// Get the most recent M2nFrame of the current thread -VMEXPORT // temporary solution for interpreter unplug +/** + * Get the most recent M2nFrame of the current thread + */ + VMEXPORT // temporary solution for interpreter unplug M2nFrame* m2n_get_last_frame(); -// Set the most recent M2nFrame of the current thread -// The caller must ensure the frame is on the current thread's activation stack -VMEXPORT // temporary solution for interpreter unplug +/** + * Set the most recent M2nFrame of the current thread + * The caller must ensure the frame is on the current thread's activation stack + */ + VMEXPORT // temporary solution for interpreter unplug void m2n_set_last_frame(M2nFrame *); -// Set the most recent M2nFrame of given thread -// The caller must ensure the frame is on the thread's activation stack -VMEXPORT +/** + * Set the most recent M2nFrame of given thread + * The caller must ensure the frame is on the thread's activation stack + */ + VMEXPORT void m2n_set_last_frame(VM_thread *, M2nFrame *); -// Get the most recent M2nFrame of the given thread -VMEXPORT // temporary solution for interpreter unplug +/** + * Get the most recent M2nFrame of the given thread + */ + VMEXPORT // temporary solution for interpreter unplug M2nFrame* m2n_get_last_frame(VM_thread *); -// Get the previous M2nFrame to the given one -VMEXPORT // temporary solution for interpreter unplug +/** + * Get the previous M2nFrame to the given one + */ + VMEXPORT // temporary solution for interpreter unplug M2nFrame* m2n_get_previous_frame(M2nFrame *); -// Get the local object handles for the M2nFrame -VMEXPORT // temporary solution for interpreter unplug +/** + * Get the local object handles for the M2nFrame + */ + VMEXPORT // temporary solution for interpreter unplug ObjectHandles* m2n_get_local_handles(M2nFrame *); -// Set the local object handles -// Note that this just updates the list, it does not free the old list -VMEXPORT // temporary solution for interpreter unplug +/** + * Set the local object handles + * + * @note This just updates the list, it does not free the old list + */ + VMEXPORT // temporary solution for interpreter unplug void m2n_set_local_handles(M2nFrame *, ObjectHandles *); -// Get the return address into the preceding managed frame -NativeCodePtr m2n_get_ip(M2nFrame *); +/** + * Get the return address into the preceding managed frame + */ + NativeCodePtr m2n_get_ip(M2nFrame *); -// ? 20040708 New function - needs proper implementation. -// Set the return address into the preceding managed frame -void m2n_set_ip(M2nFrame *, NativeCodePtr); +/** + * ? 20040708 New function - needs proper implementation. + * Set the return address into the preceding managed frame + */ + void m2n_set_ip(M2nFrame *, NativeCodePtr); -// Get the native method associated with the transition to native code -// or NULL if no such association. -Method_Handle m2n_get_method(M2nFrame *); +/** + * Get the native method associated with the transition to native code + * or NULL if no such association. + */ + Method_Handle m2n_get_method(M2nFrame *); -// Returns type of noted m2n frame +/** + * Returns type of noted m2n frame + */ frame_type m2n_get_frame_type(M2nFrame *); -// Sets type of noted m2n frame -void m2n_set_frame_type(M2nFrame *, frame_type); +/** + * Sets type of noted m2n frame + */ + void m2n_set_frame_type(M2nFrame *, frame_type); -// Returns size of m2n frame +/** + * Returns size of m2n frame + */ size_t m2n_get_size(); -// Push a special M2nFrame for managed code suspended by the OS in say -// a signal handler or exception filter. -// The frame can be popped by setting the last frame to a prior frame -void m2n_push_suspended_frame(M2nFrame* m2nf, Registers* regs); +/** + * Push a special M2nFrame for managed code suspended by the OS in say + * a signal handler or exception filter. + * The frame can be popped by setting the last frame to a prior frame + */ + void m2n_push_suspended_frame(M2nFrame* m2nf, Registers* regs); -// Push a special M2nFrame for managed code suspended by the OS in say -// a signal handler or exception filter. -// The frame can be popped by setting the last frame to a prior frame -void m2n_push_suspended_frame(VM_thread* thread, M2nFrame* m2nf, Registers* regs); +/** + *Push a special M2nFrame for managed code suspended by the OS in say + * a signal handler or exception filter. + * The frame can be popped by setting the last frame to a prior frame + */ + void m2n_push_suspended_frame(VM_thread* thread, M2nFrame* m2nf, Registers* regs); -// Push a special M2nFrame for managed code suspended by the OS in say -// a signal handler or exception filter. The frame is allocated in the heap. -// It can be popped by setting the last frame to a prior frame -// and then calling free on the frame pointer. -M2nFrame* m2n_push_suspended_frame(Registers *); +/** + * Push a special M2nFrame for managed code suspended by the OS in say + * a signal handler or exception filter. The frame is allocated in the heap. + * It can be popped by setting the last frame to a prior frame + * and then calling free on the frame pointer. + */ + M2nFrame* m2n_push_suspended_frame(Registers *); -// Push a special M2nFrame for managed code suspended by the OS in -// signal handler or exception filter. The frame is allocated in the heap. -// The frame can be popped by setting the last frame to a prior frame -// and then calling free on the frame. -M2nFrame* m2n_push_suspended_frame(VM_thread *, Registers *); +/** + * Push a special M2nFrame for managed code suspended by the OS in + * signal handler or exception filter. The frame is allocated in the heap. + * The frame can be popped by setting the last frame to a prior frame + * and then calling free on the frame. + */ + M2nFrame* m2n_push_suspended_frame(VM_thread *, Registers *); -// answers true if passed in m2n frame represents suspended frame +/** + * Answers TRUE if passed in m2n frame represents + * suspended frame. + */ bool m2n_is_suspended_frame(M2nFrame *); -// returns pointer to the registers used for jvmti PopFrame +/** + * Returns pointer to the registers used for + * jvmti PopFrame + */ Registers* get_pop_frame_registers(M2nFrame* ); -// sets pointer to the registers used for jvmti PopFrame +/** + * Sets pointer to the registers used for jvmti PopFrame + */ void set_pop_frame_registers(M2nFrame* , Registers*); #endif //!_M2N_H_ Index: include/platform_core_natives.h =================================================================== --- include/platform_core_natives.h (revision 487512) +++ include/platform_core_natives.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Euguene Ostrovsky - * @version $Revision: 1.1.2.1.4.5 $ - */ #ifndef _PLATFORM_CORE_NATIVES_H_ #define _PLATFORM_CORE_NATIVES_H_ @@ -25,7 +21,9 @@ #include "jni.h" -// TIME +/** + * TIME + */ jlong get_current_time(); #endif // _PLATFORM_CORE_NATIVES_H_ Index: include/port_atomic.h =================================================================== --- include/port_atomic.h (revision 487512) +++ include/port_atomic.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Intel, Evgueni Brevnov -* @version $Revision: 1.1.2.1.4.3 $ -*/ #ifndef _PORT_ATOMIC_H_ #define _PORT_ATOMIC_H_ @@ -46,31 +42,34 @@ /** -* Atomic compare and exchange operation -* @data[in, out] -* @value[in] new value -* @comp[in] value to compare with -* return old value -*/ + * Atomic compare and exchange operation. + * @data [in, out] + * @value[in] new value + * @comp [in] value to compare with + * + * @return Old value. + */ APR_DECLARE(uint8) port_atomic_cas8(volatile uint8 * data, uint8 value, uint8 comp); /** -* Atomic compare and exchange operation -* @data[in, out] -* @value[in] new value -* @comp[in] value to compare with -* return old value -*/ + * Atomic compare and exchange operation. + * @data [in, out] + * @value[in] new value + * @comp [in] value to compare with + * + * @return Old value. + */ APR_DECLARE(uint16) port_atomic_cas16(volatile uint16 * data, uint16 value, uint16 comp); /** -* Atomic compare and exchange operation +* Atomic compare and exchange operation. * @data[in, out] * @value[in] new value * @comp[in] value to compare with -* return old value +* +* @return Old value. */ APR_DECLARE(uint64) port_atomic_cas64(volatile uint64 * data, uint64 value, uint64 comp); Index: include/port_disasm.h =================================================================== --- include/port_disasm.h (revision 487512) +++ include/port_disasm.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.4 $ - */ #ifndef _DISASM_H_ #define _DISASM_H_ @@ -40,7 +36,7 @@ /** - * Initializes disasm module + * Initializes disasm module. * * @remark It's safe to call it several times. */ @@ -49,18 +45,22 @@ /** * Creates disassembler * - * @param disassembler The created disassembler - * @param pool The pool to use - * @remark It's safe to call this function by multiple threads with different pools + * @param disassembler - the created disassembler + * @param pool - the pool to use + * + * @remark It's safe to call this function by multiple threads with different + * pools. */ APR_DECLARE(apr_status_t) port_disassembler_create(port_disassembler_t ** disassembler, apr_pool_t * pool); /** - * @param new_info The info to set up - * @param old_info Should point to the memory to store old info in. - * NULL value should be specified if no interest for the old info. + * @param new_info - the info to set up + * @param old_info - should point to the memory to store old info in + * NULL value should be specified if no interest + * for the old info + * * @remark Not thread safe. Only one thread may change the info for the specified - disassembler + * disassembler. */ APR_DECLARE(apr_status_t) port_disasm_set_info(port_disassembler_t * disassembler, const port_disasm_info_t new_info, @@ -70,12 +70,13 @@ /** * Translates from machine native to human readable code. * - * @param disassembler The disassembler - * @param code Assembler code to translate - * @param len Number of bytes to be translated - * @param disasm_code Points to pointer to the disassembled code at exit. - * The pointer is valid until the disassembler is valid. - * @warning Not thread safe. Only one thread can use the specified disassembler + * @param disassembler - the disassembler + * @param code - assembler code to translate + * @param len - number of bytes to be translated + * @param disasm_code - points to pointer to the disassembled code at exit; + * the pointer is valid until the disassembler is valid + * + * @warning Not thread safe. Only one thread can use the specified disassembler. */ APR_DECLARE(apr_status_t) port_disasm(port_disassembler_t * disassembler, const char * code, @@ -85,10 +86,11 @@ /** * Translates from machine native to human readable code. * - * @param code Assembler code to translate - * @param len Number of bytes to be translated - * @param thefile Destination file - * @warning Not thread safe. Only one thread can use the specified disassembler + * @param code - assembler code to translate + * @param len - number of bytes to be translated + * @param thefile - destination file + * + * @warning Not thread safe. Only one thread can use the specified disassembler. */ APR_DECLARE(apr_status_t) port_disasm_to_file(port_disassembler_t * disassembler, const char * code, Index: include/port_dso.h =================================================================== --- include/port_dso.h (revision 487512) +++ include/port_dso.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Alexey V. Varlamov -* @version $Revision: 1.1.2.1.4.3 $ -*/ #ifndef _PORT_DSO_H_ #define _PORT_DSO_H_ @@ -33,7 +29,8 @@ /** * Decorate shared library name (.dll <-> lib*.so). - * The "name" parameter should be double-quoted string. + * The name parameter should be double-quoted string. + * * @non_apr */ #ifdef PLATFORM_POSIX @@ -47,8 +44,8 @@ #define PORT_DSO_BIND_DEFER 0x2 /** -* Loads shared binary (executable or library). -*/ + * Loads shared binary (executable or library). + */ APR_DECLARE(apr_status_t) port_dso_load_ex(apr_dso_handle_t** handle, const char* path, uint32 mode, @@ -56,13 +53,14 @@ /** -* Returns list of directories in which OS searches for libraries. -*/ + * Returns list of directories in which OS searches for libraries. + */ APR_DECLARE(apr_status_t) port_dso_search_path(char** path, apr_pool_t* pool); /** * Decorate shared library name (.dll <-> lib*.so). + * * @non_apr */ APR_DECLARE(char *) port_dso_name_decorate(const char* dl_name, Index: include/port_env.h =================================================================== --- include/port_env.h (revision 487512) +++ include/port_env.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with +* contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at +* the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Alexey V. Varlamov -* @version $Revision$ -*/ + #ifndef _PORT_ENV_H_ #define _PORT_ENV_H_ @@ -28,9 +25,10 @@ extern "C" { #endif - /** - * Returns all environment variable mappings as an array of KEY=VALUE strings. - */ + /** + * Returns all environment variable mappings as an array of KEY=VALUE + * strings. + */ APR_DECLARE(char **) port_env_all(apr_pool_t* pool); #ifdef __cplusplus Index: include/port_filepath.h =================================================================== --- include/port_filepath.h (revision 487512) +++ include/port_filepath.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,11 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Alexey V. Varlamov -* @version $Revision: 1.1.2.1.4.3 $ -*/ + #ifndef _PORT_FILEPATH_H_ #define _PORT_FILEPATH_H_ @@ -31,6 +28,7 @@ /** * File system separators definitions. + * * @non_apr */ #ifdef PLATFORM_POSIX @@ -45,18 +43,20 @@ # define PORT_PATH_SEPARATOR_STR ";" #endif /** -* Sticks together filepath parts. -* @non_apr -*/ + * Sticks together filepath parts. + * + * @non_apr + */ APR_DECLARE(char *) port_filepath_merge(const char* root, const char* trail, apr_pool_t* pool); /** -* Returns canonical form of the specified path. -* @non_apr -*/ + * Returns canonical form of the specified path. + * + * @non_apr + */ APR_DECLARE(char*) port_filepath_canonical(const char* original, apr_pool_t* pool); Index: include/port_general.h =================================================================== --- include/port_general.h (revision 487512) +++ include/port_general.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Alexey V. Varlamov -* @version $Revision: 1.1.2.1.4.3 $ -*/ #ifndef _PORT_GENERAL_H_ #define _PORT_GENERAL_H_ Index: include/port_malloc.h =================================================================== --- include/port_malloc.h (revision 487512) +++ include/port_malloc.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.4 $ - */ + #ifndef _PORT_MALLOC_H_ #define _PORT_MALLOC_H_ Index: include/port_sysinfo.h =================================================================== --- include/port_sysinfo.h (revision 487512) +++ include/port_sysinfo.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Alexey V. Varlamov -* @version $Revision: 1.1.2.1.4.3 $ -*/ #ifndef _PORT_SYSINFO_H_ #define _PORT_SYSINFO_H_ @@ -37,30 +33,30 @@ apr_pool_t* pool); /** -* Returns number of processors in the system. -*/ + * Returns number of processors in the system. + */ APR_DECLARE(int) port_CPUs_number(void); /** -* Returns name of CPU architecture. -*/ + * Returns name of CPU architecture. + */ APR_DECLARE(const char *) port_CPU_architecture(void); /** -* Returns OS name and version. -*/ + * Returns OS name and version. + */ APR_DECLARE(apr_status_t) port_OS_name_version(char** os_name, char** os_ver, apr_pool_t* pool); /** -* Returns name of active account. -*/ + * Returns name of active account. + */ APR_DECLARE(apr_status_t) port_user_name(char** account, apr_pool_t* pool); /** -* Returns home path of active account. -*/ + * Returns home path of active account. + */ APR_DECLARE(apr_status_t) port_user_home(char** path, apr_pool_t* pool); Index: include/port_timer.h =================================================================== --- include/port_timer.h (revision 487512) +++ include/port_timer.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with +* contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at +* the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** -* @author Alexey V. Varlamov -* @version $Revision$ -*/ + #ifndef _PORT_TIMER_H_ #define _PORT_TIMER_H_ @@ -33,10 +30,10 @@ typedef apr_int64_t apr_nanotimer_t; /** - * Returns the value of the system timer with the best possible accuracy. - * This value is not tied to the absolute time, but intended for precise - * measuring of elapsed time intervals. - */ + * Returns the value of the system timer with the best possible accuracy. + * This value is not tied to the absolute time, but intended for precise + * measuring of elapsed time intervals. + */ APR_DECLARE(apr_nanotimer_t) port_nanotimer(); #ifdef __cplusplus Index: include/port_vmem.h =================================================================== --- include/port_vmem.h (revision 487512) +++ include/port_vmem.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Alexey V. Varlamov - * @version $Revision: 1.1.2.1.4.3 $ - */ #ifndef _PORT_VMEM_H_ #define _PORT_VMEM_H_ @@ -38,24 +34,28 @@ /** * Virtual memory block descriptor. Incomplete type, - * runtime instance should be obtained via port_vmem_reserve() call + * runtime instance should be obtained via port_vmem_reserve() call */ typedef struct port_vmem_t port_vmem_t; /** * Reserves a continuous memory region in the virtual address space * of the calling process. - * @param[in,out] block descriptor for the reserved memory, required for - * further operations with the memory - * @param[in,out] address starting address of the region to allocate. If null, - * system will determine appropriate location. Actual allocated address is - * returned on success - * @param amount size of the region in bytes. For large pages, size must be - * multiply of page size. See port_vmem_page_sizes() - * @param protectionMode bit mask of PORT_VMEM_MODE_* values - * @param pageSize desired size of memory page. Value should be either - * any of PORT_VMEM_PAGESIZE_* flags or actual size in bytes. - * @param pool auxiliary pool + * + * @param[in,out] block - descriptor for the reserved memory, required for + * further operations with the memory + * @param[in,out] address - starting address of the region to allocate. If + * NULL system will determine appropriate + * location. Actual allocated address is returned on + * success + * @param amount - size of the region in bytes. For large pages, size + * must be multiply of page size. See + * port_vmem_page_sizes() + * @param protectionMode - bit mask of PORT_VMEM_MODE_* values + * @param pageSize - desired size of memory page. Value should be either + * any of PORT_VMEM_PAGESIZE_* flags or + * actual size in bytes + * @param pool - auxiliary pool */ APR_DECLARE(apr_status_t) port_vmem_reserve(port_vmem_t **block, void **address, size_t amount, @@ -63,35 +63,36 @@ size_t pageSize, apr_pool_t *pool); /** -* Commits (part of) previously reserved memory region. -* @param[in,out] address starting address of the region to commit. Returned value -* may differ due to page-alignment. -* @param amount size of the region in bytes -* @param block descriptor to the reserved virtual memory -*/ + * Commits (part of) previously reserved memory region. + * + * @param[in,out] address - starting address of the region to commit. Returned + * value may differ due to page-alignment. + * @param amount - size of the region in bytes + * @param block - descriptor to the reserved virtual memory + */ APR_DECLARE(apr_status_t) port_vmem_commit(void **address, size_t amount, port_vmem_t *block); /** -* Decommits the specified region of committed memory. It is safe to -* decommit reserved (but not committed) region. -*/ + * Decommits the specified region of committed memory. It is safe to + * decommit reserved (but not committed) region. + */ APR_DECLARE(apr_status_t) port_vmem_decommit(void *address, size_t amount, port_vmem_t *block); /** -* Releases previously reserved virtual memory region as a whole. -* If the region was committed, function first decommits it. -*/ + * Releases previously reserved virtual memory region as a whole. + * If the region was committed, function first decommits it. + */ APR_DECLARE(apr_status_t) port_vmem_release(/*void *address, size_t amount,*/ port_vmem_t *block); /** -* Returns zero-terminated array of supported memory page sizes. -* The first element refers to system default size and is guaranteed -* to be non-zero. Subsequent elements (if any) provide large page -* sizes. -*/ + * Returns zero-terminated array of supported memory page sizes. + * The first element refers to system default size and is guaranteed + * to be non-zero. Subsequent elements (if any) provide large page + * sizes. + */ APR_DECLARE(size_t *) port_vmem_page_sizes(); Index: include/stack_iterator.h =================================================================== --- include/stack_iterator.h (revision 487512) +++ include/stack_iterator.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,13 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Pavel Afremov - * @version $Revision: 1.1.2.1.4.3 $ - */ /** - *@file + * @file * Mechanism for iterating over stack frames * of Java and native code. * @@ -255,8 +251,8 @@ * * @param[in] si - the pointer to the stack iterator indicating the current frame * @param[out] regs - the pointer to the registers where the registers' values - * from the stack iterator will be copied - */ + * from the stack iterator will be copied + */ void si_copy_to_registers(StackIterator* si, Registers* regs); /** @@ -264,8 +260,8 @@ * * * @note On architectures with register stacks, ensure that the register stack of - * the current thread is consistent with its backing store. This is done because the backing - * store might have been modified by the stack walking code. + * the current thread is consistent with its backing store. This is done + * because the backing store might have been modified by the stack walking code. */ void si_reload_registers(); @@ -291,8 +287,8 @@ /** * Gets the method handle for the frame iterated by the stack iterator. * - * @param[in] si - the pointer to the stack iterator indicating the frame, - * from which control will be transfered + * @param[in] si - the pointer to the stack iterator indicating the frame, + * from which control will be transfered * @param[in] callback - pointer to the native cose adress which should be * called, after transfer control */ Index: include/tl/allocator.h =================================================================== --- include/tl/allocator.h (revision 487512) +++ include/tl/allocator.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.3 $ - */ + #ifndef TL_ALLOCATOR_H #define TL_ALLOCATOR_H @@ -33,16 +30,24 @@ class BasicAllocator { public: - // Default constructor. + /** + * Default constructor. + */ BasicAllocator() {} - // Copy constructor. + /** + * Copy constructor. + */ template BasicAllocator(const BasicAllocator& allocator) {} - // Destructor. + /** + * Destructor. + */ ~BasicAllocator() {} - // Underlying pointer, reference, etc types for this allocator. + /** + * Underlying pointer, reference, etc types for this allocator. + */ typedef T* pointer; typedef const T* const_pointer; typedef T& reference; @@ -51,11 +56,15 @@ typedef size_t size_type; typedef ptrdiff_t difference_type; - // Pointer/reference conversion. + /** + * Pointer/reference conversion. + */ pointer address(reference x) const { return &x; } const_pointer address(const_reference x) const { return &x; } - // Allocation/deallocation operations. + /** + * Allocation/deallocation operations. + */ pointer allocate(size_type n, const void* = 0) { pointer p = (pointer) STD_MALLOC(n * sizeof(T)); @@ -67,20 +76,29 @@ //STD_FREE(p); } - // Maximum allocatable size based upon size_type. + /** + * Maximum allocatable size based upon size_type. + */ size_type max_size() const { return ((size_type) -1) / sizeof(value_type); } - // Initialization/finalization operations. + /** + * Initialization/finalization operations. + */ void construct(pointer p, const value_type& x) { new (p) value_type(x); } void destroy(pointer p) { p->~value_type(); } - // Allocator equality tests + /** + * Allocator equality tests + */ template bool operator==(const BasicAllocator& allocator) { return TRUE; } template bool operator!=(const BasicAllocator& allocator) { return FALSE; } - // Type conversion utility to obtain BasicAllocator for different underlying type. + /** + * Type conversion utility to obtain BasicAllocator for different + * underlying type. + */ template struct rebind { typedef BasicAllocator other; }; }; @@ -93,17 +111,25 @@ class MPAllocator { public: - // Standard constructor + /** + * Standard constructor + */ MPAllocator(MemoryPool& mp) : pmp(&mp) {} - // Copy constructor. + /** + * Copy constructor. + */ template MPAllocator(const MPAllocator& allocator) : pmp(&allocator.getMemoryPool()) {} - // Destructor. + /** + * Destructor. + */ ~MPAllocator() {} - // Underlying pointer, reference, etc types for this allocator. + /** + * Underlying pointer, reference, etc types for this allocator. + */ typedef T* pointer; typedef const T* const_pointer; typedef T& reference; @@ -112,14 +138,20 @@ typedef size_t size_type; typedef ptrdiff_t difference_type; - // Pointer/reference conversion. + /** + * Pointer/reference conversion. + */ pointer address(reference x) const { return &x; } const_pointer address(const_reference x) const { return &x; } - // Underlying MemoryPool. + /** + * Underlying MemoryPool. + */ MemoryPool& getMemoryPool() const { return *pmp; } - // Allocation/deallocation operations. + /** + * Allocation/deallocation operations. + */ pointer allocate(size_type n, const void* = 0) { pointer p = (pointer) pmp->alloc(n * sizeof(T)); @@ -128,24 +160,34 @@ } void deallocate(void *p, size_type) {} - // Maximum allocatable size based upon size_type. + /** + * Maximum allocatable size based upon size_type. + */ size_type max_size() const { return ((size_type) -1) / sizeof(value_type); } - // Initialization/finalization operations. + /** + * Initialization/finalization operations. + */ void construct(pointer p, const value_type& x) { new (p) value_type(x); } void destroy(pointer p) { p->~value_type(); } - // Allocator equality tests + /** + * Allocator equality tests + */ template bool operator==(const MPAllocator& allocator) { return pmp == allocator.pmp; } template bool operator!=(const MPAllocator& allocator) { return pmp != allocator.pmp; } - // Type conversion utility to obtain MPAllocator for different underlying type. + /** + * Type conversion utility to obtain MPAllocator for different underlying type. + */ template struct rebind { typedef MPAllocator other; }; private: - // Disable. Cannot be instantiated without a MemoryPool. + /** + * Disable. Cannot be instantiated without a MemoryPool. + */ MPAllocator(); MemoryPool* pmp; Index: include/tl/list_mt.h =================================================================== --- include/tl/list_mt.h (revision 487512) +++ include/tl/list_mt.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.3 $ - */ + /** * This file is a part of tool library. */ @@ -59,10 +56,10 @@ bool Contains(_Key _key); /** - * Return an iterator. Collection should be locked - * to iterate over the iterator. - * Destruction of iterator unlocks collecton. - */ + * Return an iterator. Collection should be locked + * to iterate over the iterator. + * Destruction of iterator unlocks collecton. + */ Iterator GetIterator(); } // ListElement } // tl Index: include/tl/memory_pool.h =================================================================== --- include/tl/memory_pool.h (revision 487512) +++ include/tl/memory_pool.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.4 $ - */ #ifndef TL_MEMORY_POOL_H #define TL_MEMORY_POOL_H Index: include/tl/set.h =================================================================== --- include/tl/set.h (revision 487512) +++ include/tl/set.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,16 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.3 $ - */ + #ifndef STL_VECTOR_MT_H #define STL_VECTOR_MT_H -// FIXME this should be thread safe vector implementation with -// custom memory allocator. -// But now this is just wrapper for the current STL vector implementation +/** + * FIXME this should be thread safe vector implementation with + * custom memory allocator. + * But now this is just wrapper for the current STL vector implementation. + */ #include #include "tl/allocator.h" Index: include/tl/set_mt.h =================================================================== --- include/tl/set_mt.h (revision 487512) +++ include/tl/set_mt.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -13,17 +13,15 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ -/** - * @author Intel, Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.3 $ - */ + */ #ifndef TL_SET_MT_H #define TL_SET_MT_H -// FIXME this should be thread safe vector implementation with -// custom memory allocator. -// But now this is just wrapper for the current STL vector implementation +/** + * FIXME this should be thread safe vector implementation with + * custom memory allocator. + * But now this is just wrapper for the current STL vector implementation. + */ #include #include // strangely VC defines equal_range here Index: include/tl/vector.h =================================================================== --- include/tl/vector.h (revision 487512) +++ include/tl/vector.h (working copy) @@ -1,6 +1,6 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with @@ -14,17 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.3 $ - */ + #ifndef TL_VECTOR_H #define TL_VECTOR_H /** * This is just wrapper for the current STL vector - * implementation - * with default memory allocator replaced. + * implementation with default memory allocator replaced. */ #include "tl/allocator.h" #include Index: include/tl/vector_mt.h =================================================================== --- include/tl/vector_mt.h (revision 487512) +++ include/tl/vector_mt.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,17 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov - * @version $Revision: 1.1.2.1.4.3 $ - */ + #ifndef TL_VECTOR_MT_H #define TL_VECTOR_MT_H -// FIXME this should be thread safe vector implementation with -// custom memory allocator. -// But now this is just wrapper for the current STL vector -// implementation +/** + * FIXME this should be thread safe vector implementation with + * custom memory allocator. + * But now this is just wrapper for the current STL vector + * implementation. + */ #include "tl/vector.h" #include "log_macro.h" Index: src/encoder/ia32_em64t/dec_base.h =================================================================== --- src/encoder/ia32_em64t/dec_base.h (revision 487512) +++ src/encoder/ia32_em64t/dec_base.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Alexander V. Astapchuk - * @version $Revision: $ - */ /** * @file @@ -64,22 +60,26 @@ */ unsigned flags; /** - * An offset of target address, in case of 'CALL offset', - * 'JMP/Jcc offset'. + * An offset of target address, in case of CALL offset, + * JMP/Jcc offset. */ - //int offset; + + int offset; + /** * Direct address of the target (on Intel64/IA-32 is 'instruction IP' + * 'instruction length' + offset). */ - //void * direct_addr; + + void * direct_addr; + /** * Number of arguments of the instruction. */ unsigned argc; - // + EncoderBase::Operand operands[3]; - // + const EncoderBase::OpcodeDesc * odesc; }; Index: src/encoder/ia32_em64t/enc_base.h =================================================================== --- src/encoder/ia32_em64t/enc_base.h (revision 487512) +++ src/encoder/ia32_em64t/enc_base.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,16 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** - * @author Alexander V. Astapchuk - * @version $Revision: 1.1.2.3.4.4 $ + * @file Main encoding routines and structures. */ -/** - * @file - * @brief Main encoding routines and structures. - */ - #ifndef __ENC_BASE_H_INCLUDED__ #define __ENC_BASE_H_INCLUDED__ @@ -49,13 +44,13 @@ * as to retrieve some static data about instructions (number of arguments, * their roles, etc). * - * Currently, the EncoderBase class is used for both LIL and Jitrino code - * generators. Each of these code generators has its own wrapper to adapt + * Currently, the EncoderBase class is used for both LIL and Jitrino + * code generators. Each of these code generators has its own wrapper to adapt * this general interface for specific needs - see encoder.h for LIL wrappers * and Ia32Encoder.h for Jitrino's adapter. * - * Interface is provided through static methods, no instances of EncoderBase - * to be created. + * Interface is provided through static methods, no instances of + * EncoderBase to be created. * * @todo RIP-based addressing on EM64T - it's not yet supported currently. */ @@ -67,8 +62,9 @@ * @brief Generates processor's instruction. * * @param stream - a buffer to generate into - * @param mn - \link Mnemonic mnemonic \endlink of the instruction - * @param opnds - operands for the instruction + * @param mn - \link Mnemonic mnemonic \endlink of the instruction + * @param opnds - operands for the instruction + * * @returns (stream + length of the just generated instruction) */ static char * encode(char * stream, Mnemonic mn, const Operands& opnds); @@ -82,8 +78,9 @@ * The method inserts exactly number of bytes specified. It's a caller's * responsibility to make sure the buffer is big enough. * - * @param stream - buffer where to generate code into, can not be NULL + * @param stream - buffer where to generate code into, can not be NULL * @param howMany - how many bytes to fill with NOP-s + * * @return \c (stream+howMany) */ static char * nops(char * stream, unsigned howMany); @@ -95,9 +92,10 @@ * caller's responsibility to make sure the buffer is big enough. * * @param stream - buffer where to insert the prefix - * @param pref - prefix to be inserted. If it's InstPrefix_Null, then - * no action performed and return value is \c stream. - * @return \c (stream+1) if pref is not InstPrefix_Null, or \c stream + * @param pref - prefix to be inserted. If it's InstPrefix_Null, + * then no action performed and return value is \c stream. + * + * @return \c (stream+1) if pref is not InstPrefix_Null, or \c stream * otherwise */ static char * prefix(char* stream, InstPrefix pref); @@ -138,14 +136,14 @@ /** * @brief Description of operand. * - * Description of an operand in opcode - its kind, size or RegName if - * operand must be a particular register. + * Description of an operand in opcode - its kind, size or + * RegName if operand must be a particular register. */ struct OpndDesc { /** * @brief Location of the operand. * - * May be a mask, i.e. OpndKind_Imm|OpndKind_Mem. + * May be a mask, i.e. OpndKind_Imm|OpndKind_Mem. */ OpndKind kind; /** @@ -153,9 +151,9 @@ */ OpndSize size; /** - * @brief Appropriate RegName if operand must reside on a particular - * register (i.e. CWD/CDQ instructions), RegName_Null - * otherwise. + * @brief Appropriate RegName if operand must reside on a + * particular register (i.e. CWD/CDQ instructions), + * RegName_Null otherwise. */ RegName reg; }; @@ -179,24 +177,26 @@ /** * @brief Operand roles, bit-packed. * - * A bit-packed info about operands' roles. Each operand's role is + * A bit-packed info about operands roles. Each operand role is * described by two bits, counted from right-to-left - the less - * significant bits (0,1) represent operand#0. + * significant bits (0,1) represent operand#0. * * The mask is build by ORing #OpndRole_Def and #OpndRole_Use - * appropriately and shifting left, i.e. operand#0's role would be - * - '(OpndRole_Def|OpndRole_Use)' - * - opnd#1's role would be 'OpndRole_Use<<2' - * - and operand#2's role would be, say, 'OpndRole_Def<<4'. + * appropriately and shifting left, i.e. operand#0's role would be + *
      + *
    • OpndRole_Def|OpndRole_Use
    • + *
    • opnd#1's role would be OpndRole_Use<<2
    • + *
    • operand#2's role would be, say, OpndRole_Def<<4
    • + *
    */ unsigned roles; }; /** - * @brief Extracts appropriate OpndRole for a given operand. + * @brief Extracts appropriate OpndRole for a given operand. * * The order of operands is left-to-right, i.e. for MOV, it - * would be 'MOV op0, op1' + * would be MOV op0, op1 */ static OpndRole getOpndRoles(OpndRolesDesc ord, unsigned idx) { @@ -212,7 +212,7 @@ /** * @brief Raw opcode bytes. * - * 'Raw' opcode bytes which do not require any analysis and are + * Raw opcode bytes which do not require any analysis and are * independent from arguments/sizes/etc (may include opcode size * prefix). */ @@ -234,8 +234,8 @@ */ OpndRolesDesc roles; // 16 /** - * @brief If not zero, then this is final OpcodeDesc structure in - * the list of opcodes for a given mnemonic. + * @brief If not zero, then this is final OpcodeDesc + * structure in the list of opcodes for a given mnemonic. */ char last; // 1 // total: 74 @@ -250,12 +250,12 @@ */ struct MnemonicDesc { /** - * @brief The mnemonic itself. - */ + * @brief The mnemonic itself. + */ Mnemonic mn; /** - * Various characteristics of mnemonic. - * @see MF_ + * Various characteristics of mnemonic. + * @see MF_ */ unsigned flags; /** @@ -278,7 +278,7 @@ * * For meaning and arithmetics see enc_tabl.cpp. * - * The value was increased from '5155' to '8192' to make it aligned + * The value was increased from 5155 to 8192 to make it aligned * for faster access in EncoderBase::lookup(). */ static const unsigned int HASH_MAX = 8192; //5155; @@ -303,7 +303,7 @@ */ Operand() : m_kind(OpndKind_Null), m_size(OpndSize_Null), m_need_rex(false) {} /** - * @brief Creates register operand from given RegName. + * @brief Creates register operand from given RegName. */ Operand(RegName reg) : m_kind(getRegKind(reg)), m_size(getRegSize(reg)), m_reg(reg) @@ -311,12 +311,12 @@ hash_it(); } /** - * @brief Creates register operand from given RegName and with the + * @brief Creates register operand from given RegName and with the * specified size and kind. * * Used to speedup Operand creation as there is no need to extract - * size and kind from the RegName. - * The provided size and kind must match the RegName's ones though. + * size and kind from the RegName. + * The provided size and kind must match the RegName's ones though. */ Operand(OpndSize sz, OpndKind kind, RegName reg) : m_kind(kind), m_size(sz), @@ -335,7 +335,7 @@ hash_it(); } /** - * @brief Creates immediate operand of OpndSize_32. + * @brief Creates immediate operand of OpndSize_32. */ Operand(int ival) : m_kind(OpndKind_Imm), m_size(OpndSize_32), m_imm64(ival) @@ -343,7 +343,7 @@ hash_it(); } /** - * @brief Creates immediate operand of OpndSize_16. + * @brief Creates immediate operand of OpndSize_16. */ Operand(short ival) : m_kind(OpndKind_Imm), m_size(OpndSize_16), m_imm64(ival) @@ -352,7 +352,7 @@ } /** - * @brief Creates immediate operand of OpndSize_8. + * @brief Creates immediate operand of OpndSize_8. */ Operand(char ival) : m_kind(OpndKind_Imm), m_size(OpndSize_8), m_imm64(ival) @@ -437,11 +437,11 @@ bool is_mmxreg(void) const { return is_placed_in(OpndKind_MMXReg); } #endif /** - * @brief Returns base of memory operand (RegName_Null if not memory). + * @brief Returns base of memory operand (RegName_Null if not memory). */ RegName base(void) const { return is_mem() ? m_base : RegName_Null; } /** - * @brief Returns index of memory operand (RegName_Null if not memory). + * @brief Returns index of memory operand (RegName_Null if not memory). */ RegName index(void) const { return is_mem() ? m_index : RegName_Null; } /** @@ -453,7 +453,7 @@ */ int disp(void) const { return is_mem() ? m_disp : 0; } /** - * @brief Returns RegName of register operand (RegName_Null if not + * @brief Returns RegName of register operand (RegName_Null if not * register). */ RegName reg(void) const { return is_reg() ? m_reg : RegName_Null; } @@ -580,18 +580,18 @@ static char* encodeModRM(char* stream, const Operands& opnds, unsigned idx, const OpcodeDesc * odesc, Rex * prex); /** - * @brief Encodes special things of opcode description - '/r', 'ib', etc. + * @brief Encodes special things of opcode description - /r, ib, etc. */ static char* encode_aux(char* stream, unsigned aux, const Operands& opnds, const OpcodeDesc * odesc, unsigned * pargsCount, Rex* prex); #ifdef _EM64T_ /** - * @brief Returns true if the 'reg' argument represents one of the new - * EM64T registers - R8(D)-R15(D). + * @brief Returns TRUE if the 'reg' argument represents + * one of the new EM64T registers - R8(D)-R15(D). * * The 64 bits versions of 'old-fashion' registers, i.e. RAX are not - * considered as 'extra'. + * considered as extra. */ static bool is_em64t_extra_reg(const RegName reg) { @@ -626,11 +626,11 @@ return false; } /** - * @brief Returns an 'processor's index' of the register - the index + * @brief Returns an processor's index of the register - the index * used to encode the register in ModRM/SIB bytes. * - * For the new EM64T registers the 'HW index' differs from the index - * encoded in RegName. For old-fashion registers it's effectively the + * For the new EM64T registers the HW index differs from the index + * encoded in RegName. For old-fashion registers it's effectively the * same as ::getRegIndex(RegName). */ static unsigned char getHWRegIndex(const RegName reg) Index: src/encoder/ia32_em64t/enc_defs.h =================================================================== --- src/encoder/ia32_em64t/enc_defs.h (revision 487512) +++ src/encoder/ia32_em64t/enc_defs.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,16 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Alexander V. Astapchuk - * @version $Revision: 1.1.2.2.4.4 $ - */ + #ifndef _ENCODER_DEFS_H_ #define _ENCODER_DEFS_H_ -// Used to isolate experimental or being tuned encoder into a separate -// namespace so it can coexist with a stable one in the same bundle. +/** + * Used to isolate experimental or being tuned encoder into a separate + * namespace so it can coexist with a stable one in the same bundle. + */ #ifdef ENCODER_ISOLATE #define ENCODER_NAMESPACE_START namespace enc_ia32 { #define ENCODER_NAMESPACE_END }; @@ -64,20 +63,20 @@ ENCODER_NAMESPACE_START /** - * 'int_ptr' is a signed integer type which has the + * int_ptr is a signed integer type which has the * same size as a pointer on the target platform. * Luckily, the long type serves as desired. */ typedef long int_ptr; /** - * A number of bytes 'eaten' by an ordinary PUSH/POP. + * A number of bytes 'eaten' by an ordinary PUSH/POP. */ #define STACK_SLOT_SIZE (sizeof(void*)) /** * A recommended by Intel Arch Manual aligment for instructions that - * are targets for jmps. + * are targets for jmps. */ #define JMP_TARGET_ALIGMENT (16) /** @@ -85,18 +84,21 @@ */ #define MAX_NATIVE_INST_SIZE (15) /** - * The enum OpndKind describes an operand's location - memory, immediate or a register. - * It can be used as a bit mask. + * The enum #OpndKind describes an operand's location - memory, + * immediate or a register. It can be used as a bit mask. */ enum OpndKind { /** * A change must be balanced with at least the following places: - * Ia32::Constraint-s use the OpndKind as a mask - * encoder.cpp & encoder_master_info.cpp uses OpndKind as an index for hashing - * - perhaps there are much more places + *
      + *
    • Ia32::Constraint-s use the #OpndKind as a mask
    • + *
    • encoder.cpp & encoder_master_info.cpp + * uses #OpndKind as an index for hashing
    • + *
    + * Perhaps there are much more places * - * NOTE: an MMXReg kind is incompatible with the current constraints framework, - * as it's not encoded as a mask. + * @note An MMXReg kind is incompatible with the current + * constraints framework, as it's not encoded as a mask. */ OpndKind_Null=0, OpndKind_GPReg = 0x01, OpndKind_MinRegKind = OpndKind_GPReg, @@ -129,11 +131,16 @@ enum OpndSize { /** * A change must be balanced with at least the following places: - * Ia32IRConstants.h :: getByteSize() uses some presumptions about OpndSize_ values - * Ia32::Constraint-s use the OpndSize as a mask - * encoder.cpp & encoder_master_info.cpp uses OpndSize as an index for hashing - * - perhaps there are much more places + *
      + *
    • Ia32IRConstants.h :: getByteSize() uses some presumptions about + * OpndSize_ values
    • + *
    • Ia32::Constraint-s use the #OpndSize as a mask
    • + *
    • encoder.cpp & encoder_master_info.cpp uses + * #OpndSize as an index for hashing
    • + *
    + * Perhaps there are much more places. */ + OpndSize_Null = 0, OpndSize_8 = 0x01, OpndSize_16 = 0x02, @@ -149,7 +156,7 @@ }; /** - * enum OpndRole defines the role of an operand in an instruction + * enum OpndRole defines the role of an operand in an instruction * Can be used as mask to combine def and use. The complete def+use * info can be combined in 2 bits which is used, say in Encoder::OpndRole. */ @@ -170,13 +177,13 @@ RegName_Null = 0, #ifdef _EM64T_ - /* - An index part of the RegName-s for RAX-RDI, EAX-ESI, AX-SI and AL-BH is - the same as the index used during instructions encoding. The same rule - applies for XMM regsters for IA32. - For new EM64T registers (both GP and XMM) the index need to be corrected to - obtain the index used in processor's instructions. - */ + /** + * An index part of the RegName-s for RAX-RDI, EAX-ESI, AX-SI and AL-BH is + * the same as the index used during instructions encoding. The same rule + * applies for XMM regsters for IA32. + * For new EM64T registers (both GP and XMM) the index need to be corrected to + * obtain the index used in processor's instructions. + */ RegName_RAX = REGNAME(OpndKind_GPReg,OpndSize_64,0), RegName_RCX = REGNAME(OpndKind_GPReg,OpndSize_64,1), RegName_RDX = REGNAME(OpndKind_GPReg,OpndSize_64,2), @@ -660,12 +667,15 @@ * @brief Returns #RegName for a given name. * * Name is case-insensitive. + * * @param regname - string name of a register + * * @return #RegName for the given name, or #RegName_Null if name is invalid */ RegName getRegName(const char * regname); /** - * Constructs RegName from the given OpndKind, size and index. + * Constructs #RegName from the given #OpndKind, + * size and index. */ inline RegName getRegName(OpndKind k, OpndSize s, int idx) { @@ -679,7 +689,7 @@ return 1<<(reg&0xff); } /** - * @brief Extracts #RegKind from the #RegName. + * @brief Extracts RegKind from the #RegName. */ inline OpndKind getRegKind(RegName reg) { @@ -693,37 +703,37 @@ return (OpndSize)((reg>>16)&0xFF); } /** - * Extracts an index from the given RegName. + * Extracts an index from the given #RegName. */ inline unsigned char getRegIndex(RegName reg) { return (unsigned char)(reg&0xFF); } /** - * Returns a string name of the given RegName. The name returned is in upper-case. - * Returns NULL if invalid RegName specified. + * Returns a string name of the given #RegName. The name returned is in upper-case. + * Returns NULL if invalid #RegName specified. */ const char * getRegNameString(RegName reg); /** - * Returns string name of a given OpndSize. - * Returns NULL if invalid OpndSize passed. + * Returns string name of a given #OpndSize. + * Returns NULL if invalid #OpndSize passed. */ const char * getOpndSizeString(OpndSize size); /** - * Returns OpndSize passed by its string representation (case insensitive). - * Returns OpndSize_Null if invalid string specified. - * The 'sizeString' can not be NULL. + * Returns #OpndSize passed by its string representation (case insensitive). + * Returns #OpndSize_Null if invalid string specified. + * The 'sizeString' can not be NULL. */ OpndSize getOpndSize(const char * sizeString); /** - * Returns string name of a given OpndKind. - * Returns NULL if the passed kind is invalid. + * Returns string name of a given #OpndKind. + * Returns NULL if the passed kind is invalid. */ const char * getOpndKindString(OpndKind kind); /** - * Returns OpndKind found by its string representation (case insensitive). - * Returns OpndKind_Null if the name is invalid. - * The 'kindString' can not be NULL. + * Returns #OpndKind found by its string representation (case insensitive). + * Returns #OpndKind_Null if the name is invalid. + * The 'kindString' can not be NULL. */ OpndKind getOpndKind(const char * kindString); /** @@ -732,10 +742,13 @@ const char * getConditionString(ConditionMnemonic cm); /** - * Constructs an RegName with the same index and kind, but with a different size from - * the given RegName (i.e. getRegAlias(EAX, OpndSize_16) => AX; getRegAlias(BL, OpndSize_32) => EBX). - * The constructed RegName is not checked in any way and thus may be invalid. - * Note, that the aliasing does not work for at least AH,BH,CH,DH, ESI, EDI, ESP and EBP regs. + * Constructs an #RegName with the same index and kind, but with a different size from + * the given #RegName (i.e. getRegAlias(EAX, OpndSize_16) => AX; getRegAlias(BL, + * OpndSize_32) => EBX). + * + * The constructed #RegName is not checked in any way and thus may be invalid. + * + * @note The aliasing does not work for at least AH,BH,CH,DH, ESI, EDI, ESP and EBP regs. */ inline RegName getAliasReg(RegName reg, OpndSize sz) { Index: src/encoder/ia32_em64t/enc_prvt.h =================================================================== --- src/encoder/ia32_em64t/enc_prvt.h (revision 487512) +++ src/encoder/ia32_em64t/enc_prvt.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,18 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Alexander V. Astapchuk - * @version $Revision: 1.1.2.2.4.4 $ - */ + #ifndef __ENC_PRVT_H_INCLUDED__ #define __ENC_PRVT_H_INCLUDED__ #include "enc_base.h" ENCODER_NAMESPACE_START -/* +/** * @file + * * @brief Contains some definitions/constants and other stuff used by the * Encoder internally. */ @@ -63,26 +61,26 @@ #endif OpcodeByteKind_plus_i = 0x1400, /** - * a special marker, means 'no opcode on the given position' - * used in opcodes array, to specify the empty slot, say - * to fill an em64t-specific opcode on ia32. - * last 'e' made lowercase to avoid a mess with 'F' in - * OpcodeByteKind_LAST . - */ + * A special marker, means 'no opcode on the given position' + * used in opcodes array, to specify the empty slot, say + * to fill an em64t-specific opcode on ia32. + * Last 'e' made lowercase to avoid a mess with 'F' in + * OpcodeByteKind_LAST. + */ OpcodeByteKind_EMPTY = 0xFFFE, /** - * a special marker, means 'no more opcodes in the array' - * used in in opcodes array to show that there are no more - * opcodes in the array for a given mnemonic. - */ + * A special marker, means 'no more opcodes in the array' + * used in in opcodes array to show that there are no more + * opcodes in the array for a given mnemonic. + */ OpcodeByteKind_LAST = 0xFFFF, /** - * a mask to extract the OpcodeByteKind - */ + * A mask to extract the OpcodeByteKind + */ OpcodeByteKind_KindMask = 0xFF00, /** - * a mask to extract the opcode byte when presented - */ + * A mask to extract the opcode byte when presented + */ OpcodeByteKind_OpcodeMask = 0x00FF }; @@ -171,8 +169,12 @@ #define r_m16 {(OpndKind)(OpndKind_GPReg|OpndKind_Mem), OpndSize_16, RegName_Null} #define r_m32 {(OpndKind)(OpndKind_GPReg|OpndKind_Mem), OpndSize_32, RegName_Null} -//'m' was only used in LEA mnemonic, but is replaced with -// set of exact sizes. See more comments for LEA instruction in TheTable. +/** + * m was only used in LEA mnemonic, but is replaced with + * set of exact sizes. + * + * @sa TheTable. + */ //#define m {OpndKind_Mem, OpndSize_Null, RegName_Null} #define m8 {OpndKind_Mem, OpndSize_8, RegName_Null} #define m16 {OpndKind_Mem, OpndSize_16, RegName_Null} @@ -248,9 +250,9 @@ /** -* exactly the same as EncoderBase::OpcodeDesc, but also holds info about -* platform on which the opcode is applicable. -*/ + * Exactly the same as EncoderBase::OpcodeDesc, but also holds info about + * platform on which the opcode is applicable. + */ struct OpcodeInfo { enum platform { all, em64t, ia32 }; platform platf; @@ -292,15 +294,15 @@ ///@} // ~MNF /** - * @see same structure as EncoderBase::MnemonicDesc, but carries + * @see Same structure as EncoderBase::MnemonicDesc, but carries * MnemonicInfo::OpcodeInfo[] instead of OpcodeDesc[]. * Only used during prebuilding the encoding tables, thus it's hidden under * the appropriate define. */ struct MnemonicInfo { /** - * The mnemonic itself - */ + * The mnemonic itself + */ Mnemonic mn; /** * Various characteristics of mnemonic. Index: src/encoder/ia32_em64t/encoder.h =================================================================== --- src/encoder/ia32_em64t/encoder.h (revision 487512) +++ src/encoder/ia32_em64t/encoder.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,19 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** - * @author Alexander V. Astapchuk - * @version $Revision: 1.1.2.2.4.5 $ - */ -/** * @file + * * @brief Simple interface for generating processor instructions. * * The interface works for both IA32 and EM64T. By default, only IA32 - * capabilities are presented. To enable EM64T feature, the _EM64T_ macro - * must be defined (and, of course, a proper library version to be used). + * capabilities are presented. To enable EM64T feature, the _EM64T_ + * macro must be defined (and, of course, a proper library version to be used). * - * The interface is based on the original ia32.h encoder interface, + * The interface is based on the original ia32.h encoder interface, * with some simplifications and add-ons - EM64T-specific, SSE and SSE2. * * The interface mostly intended for existing legacy code like LIL code @@ -42,9 +40,13 @@ #include "open/types.h" #ifdef _EM64T_ -// size of general-purpose value on the stack in bytes +/** + * Size of general-purpose value on the stack in bytes + */ #define GR_STACK_SIZE 8 -// size of floating-point value on the stack in bytes +/** + * Size of floating-point value on the stack in bytes + */ #define FR_STACK_SIZE 8 #else #define GR_STACK_SIZE 4 @@ -52,6 +54,7 @@ #endif enum Reg_No { + #ifdef _EM64T_ rax_reg = 0,rbx_reg, rcx_reg, rdx_reg, rdi_reg, rsi_reg, rsp_reg, rbp_reg, @@ -70,12 +73,16 @@ xmm4_reg, xmm5_reg, xmm6_reg, xmm7_reg, fs_reg, #endif - /** @brief Total number of registers.*/ + /** + * @brief Total number of registers. + */ n_reg }; -// -// instruction operand sizes: 8,16,32,64 bits -// + +/** + * Instruction operand sizes: 8,16,32,64 bits + */ + enum Opnd_Size { size_8 = 0, size_16, @@ -89,18 +96,23 @@ #endif }; -// -// opcodes for alu instructions -// +/** + * Opcodes for alu instructions. + */ + + enum ALU_Opcode { add_opc = 0,or_opc, adc_opc, sbb_opc, and_opc, sub_opc, xor_opc, cmp_opc, n_alu }; -// -// opcodes for shift instructions -// + +/** + * Opcodes for shift instructions + */ + + enum Shift_Opcode { shld_opc, shrd_opc, shl_opc, shr_opc, sar_opc, ror_opc, max_shift_opcode=6, n_shift = 6 @@ -140,10 +152,11 @@ Condition_G = Condition_NLE, Condition_Count = 16 }; +/** + * Prefix code + */ -// -// prefix code -// + enum InstrPrefix { no_prefix, lock_prefix = 0xF0, @@ -163,9 +176,11 @@ }; -// -// an instruction operand -// +/** + * An instruction operand. + */ + + class Opnd { protected: @@ -293,10 +308,12 @@ R_Opnd(const R_Opnd &): RM_Opnd(Reg) { assert(false); } }; -// -// a memory operand with displacement -// Can also serve as a full memory operand with base,index, displacement and scale. -// Use n_reg to specify 'no register', say, for index. +/** + * A memory operand with displacement. + * Can also serve as a full memory operand with base, index, displacement and + * scale. + * Use n_reg to specify 'no register', say, for index. + */ class M_Opnd: public RM_Opnd { protected: @@ -324,9 +341,9 @@ inline const Imm_Opnd & disp(void) const { return m_disp; } }; -// -// a memory operand with base register and displacement -// +/** + * A memory operand with base register and displacement. + */ class M_Base_Opnd: public M_Opnd { public: @@ -337,10 +354,11 @@ // M_Base_Opnd(const M_Base_Opnd &): M_Opnd(0) { assert(false); } }; -// -// a memory operand with base register, scaled index register -// and displacement. -// +/** + * A memory operand with base register, scaled index register + * and displacement. + */ + class M_Index_Opnd : public M_Opnd { public: @@ -366,9 +384,9 @@ XMM_Opnd(const XMM_Opnd &): Opnd(XMM) { assert(false); } }; -// -// operand structures for ia32 registers -// +/** + * Operand structures for ia32 registers + */ #ifdef _EM64T_ extern R_Opnd rax_opnd; @@ -576,7 +594,9 @@ ENCODER_DECLARE_EXPORT char * scas(char * stream, unsigned char prefix); ENCODER_DECLARE_EXPORT char * stos(char * stream, unsigned char prefix); -// floating-point instructions +/** + * Floating-point instructions. + */ // st(0) = st(0) fp_op m{32,64}real //!char * fp_op_mem(char * stream, FP_Opcode opc,const M_Opnd& mem,int is_double); Index: src/lil/em64t/pim/include/lil_code_generator_em64t.h =================================================================== --- src/lil/em64t/pim/include/lil_code_generator_em64t.h (revision 487512) +++ src/lil/em64t/pim/include/lil_code_generator_em64t.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -13,16 +13,13 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ - -/** - * @author Evgueni Brevnov - * @version $Revision$ */ /** - * Stack frame layout created by LIL CG on EM64T - * + * @file + * + * Stack frame layout created by LIL CG on EM64T. + *
     
      *    |--------------------------|
      *    | Extra inputs             |
      *    |--------------------------| <--- previouse stack frame bottom
    @@ -39,14 +36,16 @@
      *    |--------------------------|
      *    | Extra outputs            |
      *    |==========================| <--- current stack frame bottom
    + *
    * - * Note: - * EM64T architecture requires stack frame bottom address - * to be aligned on 16 byte boundary (rsp % 16 == 0) + * @note EM64T architecture requires stack frame bottom address + * to be aligned on 16 byte boundary (rsp % 16 == 0) * * Register usage: - * r12-r15 are used for lil local variables (l0-l3) - * r10-r11 are used for lil standard places (sp0-sp1) + *
      + *
    • r12-r15 are used for lil local variables (l0-l3)
    • + *
    • r10-r11 are used for lil standard places (sp0-sp1)
    • + *
    */ #ifndef _LIL_CODE_GENERATOR_EM64T_ @@ -58,23 +57,23 @@ /** - * rounds up an integer value to the closest multiple of 8 + * Rounds up an integer value to the closest multiple of 8. */ inline unsigned align_8(unsigned n) { return (n + 0x7) & ~0x7; } /** - * rounds up an integer value to the closest multiple of 16 + * Rounds up an integer value to the closest multiple of 16. */ inline unsigned align_16(unsigned n) { return (n + 0xF) & ~0xF; } /** -* an enum indicating a variable's location: in a register class or on the -* stack (no LIL variable is ever on the heap!) -*/ + * An enum indicating a variable's location: in a register class or on the + * stack (no LIL variable is ever on the heap!). + */ enum LcgEM64TLocKind { LLK_Gr, // 64-bit general purpose registers LLK_Fr, // 128-bit xmm registers @@ -85,36 +84,54 @@ class LcgEM64TContext: public LilInstructionVisitor { public: - // maximum number of locals that can be placed in GR + /** + * Maximum number of locals that can be placed in GR. + */ static const unsigned MAX_GR_LOCALS = 6; - // maximum number of stand places - static const unsigned MAX_STD_PLACES = 2; - // maximum number of GR reserved for outputs/inputs - static const unsigned MAX_GR_OUTPUTS = 6; - // maximum number of FR reserved for outputs/inputs - static const unsigned MAX_FR_OUTPUTS = 8; - // maximum number of GR reserved for returns - static const unsigned MAX_GR_RETURNS = 2; - // maximum number of FR reserved for returns - static const unsigned MAX_FR_RETURNS = 2; - // maximum number of temporary XMM registers - static const unsigned MAX_FR_TEMPORARY = 8; + /** + * Maximum number of stand places. + */ + static const unsigned MAX_STD_PLACES = 2; + /** + * Maximum number of GR reserved for outputs/inputs. + */ + static const unsigned MAX_GR_OUTPUTS = 6; + /** + * Maximum number of FR reserved for outputs/inputs. + */ + static const unsigned MAX_FR_OUTPUTS = 8; + /** + * Maximum number of GR reserved for returns. + */ + static const unsigned MAX_GR_RETURNS = 2; + /** + * Maximum number of FR reserved for returns. + */ + static const unsigned MAX_FR_RETURNS = 2; + /** + * Maximum number of temporary XMM registers. + */ + static const unsigned MAX_FR_TEMPORARY = 8; - // size of GR in bytes - // TODO: Think about using GR_STACK_SIZE - static const unsigned GR_SIZE = 8; - // size of FR in bytes - // TODO: Think about using FR_STACK_SIZE - static const unsigned FR_SIZE = 8; - - // offsets for the REG_MAP array + /** + * Size of GR in bytes. + * @todo Think about using GR_STACK_SIZE static const unsigned + * GR_SIZE = 8;. + * Size of FR in bytes. + * @todo Think about using FR_STACK_SIZE static const unsigned + * FR_SIZE = 8;. + * + * Offsets for the REG_MAP array: + */ static const unsigned STD_PLACES_OFFSET = 0; static const unsigned GR_LOCALS_OFFSET = STD_PLACES_OFFSET + MAX_STD_PLACES; static const unsigned GR_OUTPUTS_OFFSET = GR_LOCALS_OFFSET + MAX_GR_LOCALS; static const unsigned GR_RETURNS_OFFSET = GR_OUTPUTS_OFFSET + MAX_GR_OUTPUTS; static const unsigned RSP_OFFSET = GR_RETURNS_OFFSET + MAX_GR_RETURNS; - // offsets for the XMM_REG_MAP array + /** + * Offsets for the XMM_REG_MAP array: + */ static const unsigned FR_OUTPUTS_OFFSET = 0; static const unsigned FR_RETURNS_OFFSET = FR_OUTPUTS_OFFSET + MAX_FR_OUTPUTS; static const unsigned FR_TEMPORARY_OFFSET = FR_RETURNS_OFFSET + MAX_FR_RETURNS; @@ -155,8 +172,8 @@ LcgEM64TContext(LilCodeStub * stub, tl::MemoryPool & m); /** - * returns general purpose register associated with given index - * this association is used across whole lil code generator + * Returns general purpose register associated with given index + * this association is used across whole lil code generator. */ static const R_Opnd & get_reg_from_map(unsigned index) { static const R_Opnd * REG_MAP[] = { @@ -175,8 +192,8 @@ } /** - * returns xmm register associated with given index - * this association is used across whole lil code generator + * Returns xmm register associated with given index + * this association is used across whole lil code generator. */ static const XMM_Opnd & get_xmm_reg_from_map(unsigned index) { static const XMM_Opnd * XMM_REG_MAP[] = { @@ -193,7 +210,8 @@ } /** - * an association between register number and index in the REG_MAP array + * An association between register number and index in the + * REG_MAP array. */ static unsigned get_index_in_map(const Reg_No reg) { static const unsigned INDEX_MAP[] = { @@ -230,14 +248,14 @@ void operator delete (void * p, tl::MemoryPool & m) {} /** - * returns the number of incoming arguments + * Returns the number of incoming arguments. */ unsigned get_num_inputs() const { return n_inputs; } /** - * returns the number of incoming arguments stored in GRs + * Returns the number of incoming arguments stored in GRs. */ unsigned get_num_gr_inputs() const { assert(n_gr_inputs <= MAX_GR_OUTPUTS); @@ -245,7 +263,7 @@ } /** - * returns the number of incoming arguments stored in FRs + * Returns the number of incoming arguments stored in FRs. */ unsigned get_num_fr_inputs() const { assert(n_fr_inputs <= MAX_FR_OUTPUTS); @@ -267,14 +285,15 @@ } /** - * returns true if m2n is required on the activation frame + * Returns TRUE if m2n is required on the activation frame. */ bool has_m2n_frame() const { return has_m2n; } /** - * returns true if we need to reserve space on the stack to save inputs + * Returns TRUE if we need to reserve space on the stack to + * save inputs. */ bool must_save_inputs() const { return save_inputs; @@ -288,86 +307,113 @@ } /** - * method which corresponds to the m2n frame + * Method which corresponds to the m2n frame. */ Method_Handle get_m2n_method() const { return m2n_method; } /** - * m2n frame type + * m2n frame type. */ frame_type get_m2n_frame_type() const { return m2n_frame_type; } /** - * returns true if m2n contains local handles + * Returns TRUE if m2n contains local handles. */ bool m2n_has_handles() const { return m2n_handles; } - // returns the offset of the start of the m2n frame - unsigned get_m2n_offset() const { + /** + * Returns the offset of the start of the m2n frame. + */ + unsigned get_m2n_offset() const { return get_input_gr_save_offset() + stk_input_gr_save_size; } - // returns the offset of the start of the gr input register save space - unsigned get_input_gr_save_offset() const { + /** + * Returns the offset of the start of the gr input register save space. + */ + unsigned get_input_gr_save_offset() const { return get_input_fr_save_offset() + stk_input_fr_save_size; } - // returns the offset of the start of the fr input register save space + /** + * Returns the offset of the start of the fr input register save space. + */ unsigned get_input_fr_save_offset() const { return get_alloc_start_offset() + stk_alloc_size; } - // returns the offset of the first "allocatable" byte + /** + * Returns the offset of the first "allocatable" byte. + */ unsigned get_alloc_start_offset() const { return get_output_offset() + stk_output_size; } - // returns the offset of the start of the m2n frame + /** + * Returns the offset of the start of the m2n frame. + */ unsigned get_output_offset() const { return 0; } - // size reserved for saving GR inputs + /** + * Size reserved for saving GR inputs. + */ unsigned get_stk_input_gr_save_size() const { return stk_input_gr_save_size; } - // size reserved for saving FR inputs + /** + * Size reserved for saving FR inputs. + */ unsigned get_stk_input_fr_save_size() const { return stk_input_fr_save_size; } - // size of allocatable memory on the stack + /** + * Size of allocatable memory on the stack. + */ unsigned get_stk_alloc_size() const { return stk_alloc_size; } - // size reserved for the m2n frame + /** + * Size reserved for the m2n frame. + */ unsigned get_stk_m2n_size() const { return stk_m2n_size; } - // bytes needed for outgoing params on the stack + /** + * Bytes needed for outgoing params on the stack. + */ unsigned get_stk_output_size() const { return stk_output_size; } - // returns the size of the stack frame + /** + * Returns the size of the stack frame. + */ unsigned get_stk_size() const { return stk_size; } private: - /* Helper functions, used by visitor functions */ + /** + * Helper functions, used by visitor functions. + */ + //@{ - // gather info from variable + /** + * Gather info from variable. + */ void check_variable(LilVariable * var, bool lvalue) { switch (lil_variable_get_kind(var)) { case LVK_In: @@ -389,7 +435,9 @@ } } - // gather info from operand + /** + * Gather info from operand. + */ void check_operand(LilOperand * o, bool lvalue) { if (o != NULL && !lil_operand_is_immed(o)) { check_variable(lil_operand_get_variable(o), lvalue); @@ -397,10 +445,12 @@ } +//@} +/** + * Visitor functions. + */ +//@{ - //************************** - // visitor functions - void label(LilLabel label) { // nothing to do here } @@ -554,7 +604,7 @@ m2n_method = method; m2n_frame_type = current_frame_type; m2n_handles = handles; - has_m2n = true; // remember that this stub requires an m2n frame + has_m2n = true; // remember that this stub requires an m2n frame does_normal_calls = true; } @@ -574,8 +624,8 @@ }; /** -* keeps location of a LIL variable -*/ + * Keeps location of a LIL variable. + */ class LcgEM64TLoc { public: Index: src/lil/em64t/pim/m2n_em64t_internal.h =================================================================== --- src/lil/em64t/pim/m2n_em64t_internal.h (revision 487512) +++ src/lil/em64t/pim/m2n_em64t_internal.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -15,19 +15,16 @@ * limitations under the License. */ -/** - * @author Evgueni Brevnov - * @version $Revision$ - */ - #ifndef _M2N_EM64T_INTERNAL_H_ #define _M2N_EM64T_INTERNAL_H_ -// This file describes the internal EM64T interface of m2n frames. -// It can be used by stubs to generate code to push and pop m2n frames, to update object handles fields, and -// to access the arguments from managed to native code. -// It is also used by stack iterators. - +/** + * @file + * This file describes the internal EM64T interface of m2n frames. + * It can be used by stubs to generate code to push and pop m2n frames, + * to update object handles fields, and to access the arguments from managed to + * native code. It is also used by stack iterators. + */ #include "m2n.h" #include "open/types.h" #include "encoder.h" @@ -40,14 +37,19 @@ * There are two types of M2nFrames: those that result from managed code calling a stub, * and those that represent suspended managed code. The second type is needed to deal with * throwing exceptions from OS contexts with the exception filter or signal mechanisms. + * * For the first type: - * rip points to the instruction past the one in question - * the bottom two bits of p_lm2nf are zero - * regs is not present, and is implicitly the address of the word above rip + *
      + *
    • rip points to the instruction past the one in question + *
    • the bottom two bits of p_lm2nf are zero + *
    • regs is not present, and is implicitly the address of the word above rip + *
    * For the second type: - * rip points to the instruction in question - * p_lm2nf==1 - * regs is present + *
      + *
    • rip points to the instruction in question + *
    • p_lm2nf==1 + *
    • regs is present + *
    */ struct M2nFrame { M2nFrame * prev_m2nf; @@ -67,7 +69,7 @@ }; /** - * returns size of m2n frame in bytes + * Returns size of m2n frame in bytes. */ inline size_t m2n_get_size() { // omit regs @@ -84,39 +86,46 @@ /** * Generate code to set the local handles of an M2nFrame. - * The M2nFrame is located bytes_to_m2n above rsp, and src_reg has the address of the frames. + * The M2nFrame is located bytes_to_m2n above rsp, + * and src_reg has the address of the frames. */ char * m2n_gen_set_local_handles_r(char * buf, unsigned bytes_to_m2n, const R_Opnd * src_reg); char * m2n_gen_set_local_handles_imm(char * buf, unsigned bytes_to_m2n, const Imm_Opnd * imm); /** * Generate code to push an M2nFrame onto the stack. - * It assumes that num_callee_saves registers have already been saved and the rest have been preserved, - * that the saved registers are immediately below the return address, and that rsp points to the last one saved. - * The order for callee saves is r12, r13, r14, r15, rbp, rbx. + * It assumes that num_callee_saves registers have already been + * saved and the rest have been preserved, that the saved registers are + * immediately below the return address, and that rsp points to the last one saved. + * The order for callee saves is r12, r13, r14, r15, rbp, rbx. * It destroys returns (rax) and outputs. * After the sequence, rsp points to the M2nFrame. * - * @param handles Indicates whether the stub will want local handles or not - * @param bytes_to_m2n_top Number of bytes to the beginning of m2n frame relative to the current rsp value. - Negative value means that current rsp is above m2n bottom. + * @param handles - indicates whether the stub will want local handles or not + * @param bytes_to_m2n_top - Number of bytes to the beginning of m2n + * frame relative to the current rsp value. + * Negative value means that current rsp is above + * m2n bottom. */ char * m2n_gen_push_m2n(char * buf, Method_Handle method, frame_type current_frame_type, bool handles, unsigned num_callee_saves, unsigned num_std_need_to_save, int32 bytes_to_m2n_top); /** * Generate code to pop an M2nFrame off the stack. - * @param num_callee_saves Number of callee saves registers to leave - * on the stack as at the entry to push_m2n. - * @param bytes_to_m2n_bottom Number of bytes between rsp and the bottom of the M2nFrame. - * @param preserve_ret Number of return registers to preserve, 0 means none, - * 1 means rax, 2 means rax & rdx. - * @param handles As for push_m2n, frees the handles if true. + * + * @param num_callee_saves - number of callee saves registers to leave + * on the stack as at the entry to push_m2n + * @param bytes_to_m2n_bottom - number of bytes between rsp and the bottom of the M2nFrame + * @param preserve_ret - number of return registers to preserve, 0 means none, + * 1 means rax, 2 means rax & rdx. + * @param handles - as for push_m2n, frees the handles if true */ char * m2n_gen_pop_m2n(char * buf, bool handles, unsigned num_callee_saves, int32 bytes_to_m2n_bottom, unsigned preserve_ret); -// returns top of the specified frame on the stack (it should point to return ip) +/** + * Returns top of the specified frame on the stack (it should point to return ip) + */ void * m2n_get_frame_base(M2nFrame *); #endif // _M2N_EM64T_INTERNAL_H_ Index: src/lil/ia32/pim/include/lil_code_generator_ia32.h =================================================================== --- src/lil/ia32/pim/include/lil_code_generator_ia32.h (revision 487512) +++ src/lil/ia32/pim/include/lil_code_generator_ia32.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,12 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov, Ivan Volosyuk - * @version $Revision: 1.1.2.1.4.4 $ - */ - #ifndef _LIL_CODE_GENERATOR_IA32_ #define _LIL_CODE_GENERATOR_IA32_ Index: src/lil/ia32/pim/m2n_ia32_internal.h =================================================================== --- src/lil/ia32/pim/m2n_ia32_internal.h (revision 487512) +++ src/lil/ia32/pim/m2n_ia32_internal.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,19 +14,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov, Ivan Volosyuk - * @version $Revision: 1.1.2.1.4.4 $ - */ - #ifndef _M2N_IA32_INTERNAL_H_ #define _M2N_IA32_INTERNAL_H_ -// This file describes the internal IPF interface of m2n frames. -// It can be used by stubs to generate code to push and pop m2n frames, to update object handles fields, and -// to access the arguments from managed to native code. -// It is also used by stack iterators. +/** + * @file + * This file describes the internal IPF interface of m2n frames. + * It can be used by stubs to generate code to push and pop m2n frames, to + * update object handles fields, and to access the arguments from managed to + * native code. + * It is also used by stack iterators. + */ #include "m2n.h" #include "vm_threads.h" @@ -34,58 +33,92 @@ class R_Opnd; -// Return a pointer to the argument just above the return address of an M2nFrame +/** + * Return a pointer to the argument just above the return address of an M2nFrame. + */ uint32* m2n_get_args(M2nFrame*); -// An M2nFrame is a structure that resides on the stack. -// It takes up space below and including the return address to the managed code, and thus is immediately below the arguments. - -// This is the size of the structure that goes on the stack. +/** + * An M2nFrame is a structure that resides on the stack. + * It takes up space below and including the return address to the managed code, + * and thus is immediately below the arguments. + * + * This is the size of the structure that goes on the stack. + */ const unsigned m2n_sizeof_m2n_frame = 44; -// Generate code to put the thread local storage pointer into a given register +/** + * Generate code to put the thread local storage pointer into a given register. + */ unsigned m2n_ts_to_register_size(); char* m2n_gen_ts_to_register(char* buf, R_Opnd* reg); -// Generate code to push an M2nFrame onto the stack. -// It assumes that num_callee_saves registers have already been saved and the rest have been preserved, that the saved registers are immediately -// below the return address, and that esp points to the last one saved. The order for callee saves is ebp, ebx, esi, edi. -// It destroys eax. -// After the sequence, esp points to the M2nFrame. -// handles: will the stub want local handles or not +/** + * Generate code to push an M2nFrame onto the stack. + * It assumes that num_callee_saves registers have already been + * saved and the rest have been preserved, that the saved registers are immediately + * below the return address, and that esp points to the last one saved. + * The order for callee saves is ebp, ebx, esi, edi. + * + * It destroys eax. + * + * After the sequence, esp points to the M2nFrame. + * + * Handles: will the stub want local handles or not. + */ unsigned m2n_push_m2n_size(bool handles, unsigned num_callee_saves); char* m2n_gen_push_m2n(char* buf, Method_Handle method, frame_type current_frame_type, bool handles, unsigned num_callee_saves); -// Generate code to set the local handles of an M2nFrame -// The M2nFrame is located bytes_to_m2n above esp, and src_reg has the address of the frames. +/** + * Generate code to set the local handles of an M2nFrame. + * The M2nFrame is located bytes_to_m2n above esp, + * and src_reg has the address of the frames. + */ unsigned m2n_set_local_handles_size(unsigned bytes_to_m2n); char* m2n_gen_set_local_handles(char* buf, unsigned bytes_to_m2n, R_Opnd* src_reg); -// Generate code to pop an M2nFrame off the stack. -// num_callee_saves: the number of callee saves registers to leave on the stack as at the entry to push_m2n. -// extra_on_stack: the number of bytes between esp and the bottom of the M2nFrame. -// preserve_ret: the number of return registers to preserve, 0 means none, 1 means eax, 2 means eax & edx; st(0) is always preserved. -// handles: as for push_m2n, frees the handles if true. +/** + * Generate code to pop an M2nFrame off the stack. + * + * @param num_callee_saves - the number of callee saves registers to leave on + * the stack as at the entry to push_m2n + * @param extra_on_stack: - the number of bytes between esp and the + * bottom of the M2nFrame + * @param preserve_ret - the number of return registers to preserve, 0 means none, + * 1 means eax, 2 means eax and + * edx; st(0) is always preserved. + * @param handles - as for push_m2n, frees the handles if true. + */ unsigned m2n_pop_m2n_size(bool handles, unsigned num_callee_saves, unsigned extra_on_stack, unsigned preserve_ret); char* m2n_gen_pop_m2n(char* buf, bool handles, unsigned num_callee_saves, unsigned extra_on_stack, unsigned preserve_ret); -////////////////////////////////////////////////////////////////////////// -// Implementation details +/** + * Implementation Details + * + * This information is used by the m2n implementation and the stack + * iterator implementation. It may not be used by any other module. + * + * There are two types of M2nFrames: those that result from managed code calling a stub, + * and those that represent suspended managed code. The second type is needed to deal + * with throwing exceptions from OS contexts with the exception filter or signal mechanisms. + * + * For the first type: + *
      + *
    • eip points to the instruction past the one in question (ie + * is the return address into managed code)
    • + *
    • the bottom two bits of p_lm2nf are zero
    • + *
    • regs is not present, and is implicitly the address of the word + * above eip
    • + *
    + * + * For the second type: + *
      + *
    • eip points to the instruction in question
    • + *
    • p_lm2nf==1
    • + *
    • regs is present
    • + *
    + */ -// This information is used by the m2n implementation and the stack iterator implementation. -// It may not be used by any other module. - -// There are two types of M2nFrames: those that result from managed code calling a stub, and those that represent suspended managed code. -// The second type is needed to deal with throwing exceptions from OS contexts with the exception filter or signal mechanisms. -// For the first type: -// eip points to the instruction past the one in question (ie is the return address into managed code) -// the bottom two bits of p_lm2nf are zero -// regs is not present, and is implicitly the address of the word above eip -// For the second type: -// eip points to the instruction in question -// p_lm2nf==1 -// regs is present - #ifdef _EM64T_ #error Wrong header file. #endif Index: src/lil/ipf/pim/include/lil_code_generator_ipf.h =================================================================== --- src/lil/ipf/pim/include/lil_code_generator_ipf.h (revision 487512) +++ src/lil/ipf/pim/include/lil_code_generator_ipf.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,24 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov, Ivan Volosyuk - * @version $Revision: 1.1.2.1.4.4 $ - */ - #ifndef _LIL_CODE_GENERATOR_IPF_ #define _LIL_CODE_GENERATOR_IPF_ #include "lil.h" #include "lil_code_generator.h" -// this class is for internal use only; it is declared in -// lil_code_generator_ipf.cpp +/** + * This class is for internal use only; it is declared in + * lil_code_generator_ipf.cpp. + */ + class LcgIpfContext; class Merced_Code_Emitter; - class LilCodeGeneratorIpf : public LilCodeGenerator { public: LilCodeGeneratorIpf(); Index: src/lil/ipf/pim/m2n_ipf_internal.h =================================================================== --- src/lil/ipf/pim/m2n_ipf_internal.h (revision 487512) +++ src/lil/ipf/pim/m2n_ipf_internal.h (working copy) @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -14,100 +14,161 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Evgueni Brevnov, Ivan Volosyuk - * @version $Revision: 1.1.2.1.4.4 $ - */ - #ifndef _M2N_IPF_INTERNAL_H_ #define _M2N_IPF_INTERNAL_H_ -// This file describes the internal IPF interface of m2n frames. -// It can be used by stubs to generate code to push and pop m2n frames and to update object handles fields. -// It is also used by stack iterators. +/** + * @file + * This file describes the internal IPF interface of m2n frames. + * It can be used by stubs to generate code to push and pop m2n frames and + * to update object handles fields. It is also used by stack iterators. + */ #include "Code_Emitter.h" #include "m2n.h" #include "open/types.h" -// Generate code to push an M2nFrame onto the stack -// The activation frame of the stub is used for the M2nFrame as are certain registers in this frame. -// The stub must preserve all preserved registers including pfs, gp, and b0 from entry to the stub to the time of push_m2n. -// The stub may use up to 8 inputs, the requested number of locals, and the requested number of outputs after push_m2n. -// method: the method to be associated with the M2nFrame or NULL for no association -// handles: does the stub want local handles or not -// num_on_stack: this number plus the current sp is the sp at entry to the stub (should be positive as stack grows down) -// num_local: the number of local registers above the M2N registers required by the stub -// num_outputs: the number of output registers required by the stub -// do_alloc: if false, the function should assume that the stacked register -// frame has been allocated, and no alloc instruction needs to be executed; it should also assume that ar.pfs is already saved at its proper place -// return: the register number for the first local, the outputs immediately follow the locals -// Note, the stub may use some of the 8 inputs as locals if it wants to -unsigned m2n_gen_push_m2n(Merced_Code_Emitter*, Method_Handle method, frame_type current_frame_type, bool handles, unsigned num_on_stack, unsigned num_locals, - unsigned num_outputs, bool do_alloc=true); - +/** + * Generate code to push an M2nFrame onto the stack. + * The activation frame of the stub is used for the M2nFrame as are certain + * registers in this frame. The stub must preserve all preserved registers + * including pfs, gp, and b0 from entry + * to the stub to the time of push_m2n. + * + * The stub may use up to 8 inputs, the requested number of locals, and the + * requested number of outputs after push_m2n. + * + * @param method - the method to be associated with the M2nFrame or + * NULL for no association + * @param handles - does the stub want local handles or not + * @param num_on_stack - this number plus the current sp is the sp at entry + * to the stub (should be positive as stack grows down) + * @param num_local - the number of local registers above the M2N + * registers required by the stub + * @param num_outputs - the number of output registers required by the stub + * @param do_alloc - if false, the function should assume that the stacked register + * frame has been allocated, and no alloc instruction needs + * to be executed; it should also assume that ar.pfs + * is already saved at its proper place + * + * @return The register number for the first local, the outputs immediately + * follow the locals. + * + * @note The stub may use some of the 8 inputs as locals if it wants to + * unsigned m2n_gen_push_m2n(Merced_Code_Emitter*, Method_Handle method, + * frame_type current_frame_type, bool handles, unsigned num_on_stack, + * unsigned num_locals, unsigned num_outputs, bool do_alloc=true); + */ enum M2nPreserveRet { MPR_None, MPR_Gr, MPR_Fr }; -// Generate code to pop the M2nFrame from the stack. -// This should be matched by a preceeding push_m2n in the stub. -// handles: should match the push_m2n handles argument, if true the generated code will free the handles. -// preserve_ret_regs: the number of return registers to preserve (starting with r8). -// Note that the pop restores the callee saves gp registers, pfs, gp, and b0 to the values that had at the push m2n; it does not restore sp. -// do_alloc: must have the same value as the corresponding m2n_gen_push_m2n() parameter -// target: if handles==true and the vm property vm.free_local_object_handles -// is also true, m2n_gen_pop_m2n will need to set a target in the emitter; -// target will be the number used. Otherwise, this parameter is ignored. -// out_reg: if handles==true and the vm property vm.free_local_object_handles -// is also true, m2n_gen_pop_m2n needs to know the first output register; out_reg is this register. Otherwise this parameter is ignored +/** + * Generate code to pop the M2nFrame from the stack. + * This should be matched by a preceeding push_m2n in the stub. + * + * @param handles - should match the push_m2n handles + * argument, if true the generated code will free + * the handles + * @param preserve_ret_regs - the number of return registers to preserve + * (starting with r8) + * + * @note The pop restores the callee saves gp registers, pfs, + * gp, and b0 to the values that had at the + * push m2n; it does not restore sp. + * + * @param do_alloc - must have the same value as the corresponding + * m2n_gen_push_m2n() parameter + * @param target - if handles is TRUE and the vm property + * vm.free_local_object_handles is also + * TRUE, m2n_gen_pop_m2n will need + * to set a target in the emitter; target will be the number used. + * Otherwise, this parameter is ignored. + * @param out_reg - if handles is TRUE and the vm property + * vm.free_local_object_handles is also TRUE, + * m2n_gen_pop_m2n needs to know the first output + * register; out_reg is this register. Otherwise this parameter + * is ignored. + */ + void m2n_gen_pop_m2n(Merced_Code_Emitter*, bool handles, M2nPreserveRet preserve_ret_regs, bool do_alloc=true, unsigned out_reg=0, int target=-1); -// Generate code to set the local handles of the M2nFrame that is also the current frame. -// Preserves all registers that are not used to store M2nFrame information. +/** + * Generate code to set the local handles of the M2nFrame that is also the + * current frame. Preserves all registers that are not used to store M2nFrame + * information. + */ void m2n_gen_set_local_handles(Merced_Code_Emitter*, unsigned src_reg); -// Generate code to set the local handles of the M2nFrame that is also the current frame. -// Preserves all registers that are not used to store M2nFrame information. +/** + * Generate code to set the local handles of the M2nFrame that is also the + * current frame. Preserves all registers that are not used to store M2nFrame + * information. + */ void m2n_gen_set_local_handles_imm(Merced_Code_Emitter*, uint64 imm_val); -// Generate code to save additional preserved registers not normally saved by push_m2n. -// The combination of push_m2n and save_extra_preserved_registers will save all preserved registers as needed by exception propogation. -// The code generated by this function must follow that of push_m2n. -// Note that this function uses the memory stack, expects the scratch area above sp, and leaves a scratch area above sp. +/** + * Generate code to save additional preserved registers not normally saved by + * push_m2n. + * The combination of push_m2n and save_extra_preserved_registers + * will save all preserved registers as needed by exception propogation. + * The code generated by this function must follow that of push_m2n. + * + * @note This function uses the memory stack, expects the scratch area above + * sp, and leaves a scratch area above sp. + */ void m2n_gen_save_extra_preserved_registers(Merced_Code_Emitter* emitter); -// returns the number of the last GR that the M2N frame uses +/** + * Returns the number of the last GR that the M2N + * frame uses. + */ unsigned m2n_get_last_m2n_reg(); -// the following functions return the GR numbers where various things should be saved +/** + * The following functions return the GR numbers where various things should + * be saved. + */ unsigned m2n_get_pfs_save_reg(); unsigned m2n_get_return_save_reg(); unsigned m2n_get_gp_save_reg(); -// The IPF calling convention defines how to layout the arguments into words and then how to place -// these into gp registers, fp registers, or memory stack. This function returns a pointer to the -// nth word assuming it is either in a gp register or on the memory stack. +/** + * The IPF calling convention defines how to layout the arguments into words and + * then how to place these into gp registers, fp + * registers, or memory stack. This function returns a pointer to the + * nth word assuming it is either in a gp register or + * on the memory stack. + */ uint64* m2n_get_arg_word(M2nFrame*, unsigned n); -////////////////////////////////////////////////////////////////////////// -// Implementation details +/** + * Implementation details + * + * An M2nFrame is always represented using the bsp value for register 32 of the + * frame. + * The information needed for the frame is stored in stacked local registers or + * on the memory stack. It can be accessed by computing the spill location from + * the bsp value or by retrieving the sp value. + */ -// An M2nFrame is always represented using the bsp value for register 32 of the frame -// The information needed for the frame is stored in stacked local registers or on the memory stack. -// It can be accessed by computing the spill location from the bsp value or by retrieving the sp value and - uint64* m2n_get_bsp(M2nFrame*); uint64* m2n_get_extra_saved(M2nFrame*); -// An M2nFrame will always have 8 input registers, some local stacked registers to save stuff, and some outputs +/** + * An M2nFrame will always have 8 input registers, some local stacked registers + * to save stuff, and some outputs. + */ #define M2N_NUMBER_ALIGNS 2 #define M2N_NUMBER_INPUTS 8 #define M2N_NUMBER_LOCALS 14 -// The following registers are used in M2nFrames to hold the indicated values -// The register numbers must be distinct, at least 40 (so they don't conflict with inputs), and less than 40+M2N_NUMBER_LOCALS +/** + * The following registers are used in M2nFrames to hold the indicated values. + * The register numbers must be distinct, at least 40 (so they don't conflict + * with inputs), and less than 40+M2N_NUMBER_LOCALS. + */ #define M2N_SAVED_PFS 40 #define M2N_SAVED_RETURN_ADDRESS 41 @@ -124,27 +185,33 @@ #define M2N_METHOD 52 #define M2N_FRAME_TYPE 53 -// Only the callee saves general registers are normally saved in the M2nFrame along with special things like pfs, return address, etc. -// The full set of preserved registers includes callee saves floating point and branch registers as well. -// These are saved, if requested, onto the memory stack as follows: -// +-------------------------+ -// | Saved f2 | -// Extra Saved ---> +-------------------------+ -// | Saved f3..f5 | -// +-------------------------+ -// | Saved f16..f31 | -// +-------------------------+ -// | Scratch area (8 bytes) | -// +-------------------------+ -// | Saved b1..b5 | -// +-------------------------+ -// | Saved ar.fpsr | -// +-------------------------+ -// | Saved ar.unat | -// +-------------------------+ -// | Saved ar.lc | -// +-------------------------+ - +/** + * Only the callee saves general registers are normally saved in the M2nFrame + * along with special things like pfs, return address, etc. + * The full set of preserved registers includes callee saves floating point + * and branch registers as well. + * + * These are saved, if requested, onto the memory stack as follows: + *
    + *                  +-------------------------+
    + *                  | Saved f2                |
    + * Extra Saved ---> +-------------------------+
    + *                  | Saved f3..f5            |
    + *                  +-------------------------+
    + *                  | Saved f16..f31          |
    + *                  +-------------------------+
    + *                  | Scratch area (8 bytes)  |
    + *                  +-------------------------+
    + *                  | Saved b1..b5            |
    + *                  +-------------------------+
    + *                  | Saved ar.fpsr           |
    + *                  +-------------------------+
    + *                  | Saved ar.unat           |
    + *                  +-------------------------+
    + *                  | Saved ar.lc             |
    + *                  +-------------------------+
    + * 
    + */ #define M2N_EXTRA_SAVES_SPACE 400 #ifdef _EM64T_