-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathinterface.h
46 lines (36 loc) · 927 Bytes
/
interface.h
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
44
45
46
// Copyright (C) 2018 Cornell University
#pragma once
#include <jni.h>
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);
};