view src/gpu/hsail/vm/gpu_hsail_Frame.hpp @ 15482:a250a512434d

HSAIL: support for object values in stack slots at deoptimization points Contributed-by: Tom Deneau <tom.deneau@amd.com>
author Doug Simon <doug.simon@oracle.com>
date Fri, 02 May 2014 21:58:28 +0200
parents 3e9a960f0da1
children 217c721b1ee1
line wrap: on
line source

#ifndef GPU_HSAIL_FRAME_HPP
#define GPU_HSAIL_FRAME_HPP

#include "graal/graalEnv.hpp"
#include "code/debugInfo.hpp"
#include "code/location.hpp"

class HSAILFrame {
  friend class VMStructs;
private:
  jint  _pc_offset;  // The HSAIL "pc_offset" where the exception happens
  jbyte _num_s_regs;
  jbyte _num_d_regs;
  jshort _num_stack_slots; 
  jbyte  _save_area[0];     // save area size can vary per kernel compilation  

public:
  // Accessors
  jint pc_offset() { return _pc_offset; }
  jint num_s_regs() {return _num_s_regs; }
  jint num_d_regs() {return _num_d_regs; }
  jint num_stack_slots() {return _num_stack_slots; }
  jlong get_d_reg(int idx) {
    int ofst = num_s_regs() * 4 + idx * 8;
    return(*(jlong *) (_save_area + ofst));
  }
  jint get_s_reg(int idx) {
    int ofst = idx * 4;
    return(*(jint *) (_save_area + ofst));
  }
  void put_d_reg(int idx, jlong val) {
    int ofst = num_s_regs() * 4 + idx * 8;
    (*(jlong *) (_save_area + ofst)) = val;
  }
  jint get_stackslot32(int stackOffset) {
    int ofst = num_s_regs() * 4 + num_d_regs() * 8 + stackOffset;
    return(*(jint *) (_save_area + ofst));
  }
  jlong get_stackslot64(int stackOffset) {
    int ofst = num_s_regs() * 4 + num_d_regs() * 8 + stackOffset;
    return(*(jlong *) (_save_area + ofst));
  }
  void put_stackslot64(int stackOffset, jlong val) {
    int ofst = num_s_regs() * 4 + num_d_regs() * 8 + stackOffset;
    (*(jlong *) (_save_area + ofst)) = val;
  }
};
  
#endif // GPU_HSAIL_FRAME_HPP