mirror of
https://github.com/corda/corda.git
synced 2025-01-22 12:28:11 +00:00
refactor compile.cpp to delay code generation until after all byte code has been visited; bugfixes
This commit is contained in:
parent
74a0ae3493
commit
ec8fc80ebe
1228
src/compiler.cpp
1228
src/compiler.cpp
File diff suppressed because it is too large
Load Diff
15
src/vector.h
15
src/vector.h
@ -20,13 +20,24 @@ class Vector {
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
if (data) {
|
||||
if (data and minimumCapacity >= 0) {
|
||||
s->free(data);
|
||||
}
|
||||
}
|
||||
|
||||
void wrap(uint8_t* data, unsigned capacity) {
|
||||
dispose();
|
||||
|
||||
this->data = data;
|
||||
this->position = 0;
|
||||
this->capacity = capacity;
|
||||
this->minimumCapacity = -1;
|
||||
}
|
||||
|
||||
void ensure(unsigned space) {
|
||||
if (position + space > capacity) {
|
||||
assert(s, minimumCapacity >= 0);
|
||||
|
||||
unsigned newCapacity = max
|
||||
(position + space, max(minimumCapacity, capacity * 2));
|
||||
uint8_t* newData = static_cast<uint8_t*>(s->allocate(newCapacity));
|
||||
@ -101,7 +112,7 @@ class Vector {
|
||||
uint8_t* data;
|
||||
unsigned position;
|
||||
unsigned capacity;
|
||||
unsigned minimumCapacity;
|
||||
int minimumCapacity;
|
||||
};
|
||||
|
||||
} // namespace vm
|
||||
|
Loading…
Reference in New Issue
Block a user