hotspot/src/share/vm/adlc/adlc.hpp
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1 489c9b5090e2
child 775 d9c9b9cd55fb
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
// Standard include file for ADLC parser
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
// standard library constants
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
#include "stdio.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
#include "stdlib.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
#if _MSC_VER >= 1300  // Visual C++ 7.0 or later
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
#include <iostream>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
#include <iostream.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
#include "string.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
#include "ctype.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
#include "stdarg.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
#include <sys/types.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
#if _MSC_VER >= 1300
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
using namespace std;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// make sure the MSC_VER and _MSC_VER settings make sense
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
#if _MSC_VER != MSC_VER && (_MSC_VER != 1400 || MSC_VER != 1399)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
#error "Something is wrong with the detection of MSC_VER in the makefiles"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
#if _MSC_VER >= 1400 && !defined(_WIN64)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
#define strdup _strdup
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
/* Make sure that we have the intptr_t and uintptr_t definitions */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
#ifdef _WIN32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
#ifndef _INTPTR_T_DEFINED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
typedef __int64 intptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
typedef int intptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
#define _INTPTR_T_DEFINED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
#ifndef _UINTPTR_T_DEFINED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
typedef unsigned __int64 uintptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
typedef unsigned int uintptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
#define _UINTPTR_T_DEFINED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
#endif // _WIN32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
#ifdef LINUX
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  #include <inttypes.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
#endif // LINUX
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
// Macros
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
#define uint32 unsigned int
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
#define uint   unsigned int
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
// Macros
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
// Debugging note:  Put a breakpoint on "abort".
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
#define assert(cond, msg) { if (!(cond)) { fprintf(stderr, "assert fails %s %d: %s\n", __FILE__, __LINE__, msg); abort(); }}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
#define max(a, b)   (((a)>(b)) ? (a) : (b))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
// VM components
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
#include "opcodes.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
// ADLC components
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
#include "arena.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
#include "adlcVMDeps.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
#include "filebuff.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
#include "dict2.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
#include "forms.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
#include "formsopt.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
#include "formssel.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
#include "archDesc.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
#include "adlparse.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
// globally define ArchDesc for convenience.  Alternatively every form
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
// could have a backpointer to the AD but it's too complicated to pass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
// it everywhere it needs to be available.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
extern ArchDesc* globalAD;