CUBRID Engine  latest
xasl_unpack_info.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * xasl_unpack_info - interface to information used during packing
21  */
22 
23 #ifndef _XASL_UNPACK_INFO_HPP_
24 #define _XASL_UNPACK_INFO_HPP_
25 
26 #include "porting.h"
27 #include "system.h"
28 #include "thread_compat.hpp"
29 
30 const size_t MAX_PTR_BLOCKS = 256;
31 
32 /* structure of a visited pointer constant */
35 {
36  const void *ptr; /* a pointer constant */
37  void *str; /* where the struct pointed by 'ptr' is stored */
38 };
39 
40 /* structure for additional memory during filtered predicate unpacking */
43 {
44  char *buff;
46 };
47 
48 /* structure to hold information needed during packing */
51 {
52  char *packed_xasl; /* ptr to packed xasl tree */
53 #if defined (SERVER_MODE)
54  THREAD_ENTRY *thrd; /* used for private allocation */
55 #endif /* SERVER_MODE */
56 
57  /* blocks of visited pointer constants */
59 
60  char *alloc_buf; /* alloced buf */
61 
62  int packed_size; /* packed xasl tree size */
63 
64  /* low-water-mark of visited pointers */
65  int ptr_lwm[MAX_PTR_BLOCKS];
66 
67  /* max number of visited pointers */
68  int ptr_max[MAX_PTR_BLOCKS];
69 
70  int alloc_size; /* alloced buf size */
71 
72  /* list of additional buffers allocated during xasl unpacking */
74  /* 1 if additional buffers should be tracked */
76 
77  bool use_xasl_clone; /* true, if uses xasl clone */
78 };
79 
82 
84 void free_unpack_extra_buff (THREAD_ENTRY *thread_p, XASL_UNPACK_INFO *unpack_info_ptr);
85 
86 inline int xasl_stream_get_ptr_block (const void *ptr);
87 
88 inline int
90 {
91  return static_cast<int> ((((UINTPTR) ptr) / sizeof (UINTPTR)) % MAX_PTR_BLOCKS);
92 }
93 
94 #endif // !_XASL_UNPACK_INFO_HPP_
void set_xasl_unpack_info_ptr(THREAD_ENTRY *thread_p, XASL_UNPACK_INFO *ptr)
UNPACK_EXTRA_BUF * additional_buffers
XASL_UNPACK_INFO * get_xasl_unpack_info_ptr(THREAD_ENTRY *thread_p)
void THREAD_ENTRY
void free_xasl_unpack_info(THREAD_ENTRY *thread_p, REFPTR(XASL_UNPACK_INFO, xasl_unpack_info))
#define REFPTR(T, name)
Definition: porting.h:1089
const size_t MAX_PTR_BLOCKS
const void * ptr
void free_unpack_extra_buff(THREAD_ENTRY *thread_p, XASL_UNPACK_INFO *unpack_info_ptr)
int xasl_stream_get_ptr_block(const void *ptr)
UNPACK_EXTRA_BUF * next