forked from polyglot-compiler/JLang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.h
More file actions
43 lines (34 loc) · 814 Bytes
/
Copy pathinterface.h
File metadata and controls
43 lines (34 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//Copyright (C) 2018 Cornell University
#pragma once
extern "C" {
void* __getInterfaceMethod(jobject obj, int intf_id_hash, void* intf_id, int method_index);
struct idv_ht_node {
idv_ht_node* next;
void* intf_id;
void* idv;
};
} // extern "C"
// The hash table of interface dispatch vectors.
// representation type is actually a linked list
class idv_ht {
public:
/**
* Constructor.
* @param capacity must be a power of 2
*/
idv_ht(size_t capacity);
/**
* Fetch an interface dispatch vector with its precomputed hash
* code.
*/
void* get(int hashcode, void* intf_id);
/**
* Add an interface dispatch vector with its precomputed hash
* code.
*/
void put(int hashcode, void* intf_id, void* idv);
private:
idv_ht_node** table;
size_t capacity;
size_t getIndexForHash(int h);
};