|
@@ -28,7 +28,6 @@ Block::Block()
|
|
|
|
|
|
Block::~Block()
|
|
|
{
|
|
|
- unseal();
|
|
|
Bytecode::InstructionStreamIterator it(instruction_stream());
|
|
|
while (!it.at_end()) {
|
|
|
auto& to_destroy = (*it);
|
|
@@ -39,20 +38,12 @@ Block::~Block()
|
|
|
munmap(m_buffer, m_buffer_capacity);
|
|
|
}
|
|
|
|
|
|
-void Block::seal() const
|
|
|
+void Block::seal()
|
|
|
{
|
|
|
- if (mprotect(m_buffer, m_buffer_capacity, PROT_READ) < 0) {
|
|
|
- perror("ByteCode::Block::seal: mprotect");
|
|
|
- VERIFY_NOT_REACHED();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-void Block::unseal()
|
|
|
-{
|
|
|
- if (mprotect(m_buffer, m_buffer_capacity, PROT_READ | PROT_WRITE) < 0) {
|
|
|
- perror("ByteCode::Block::unseal: mprotect");
|
|
|
- VERIFY_NOT_REACHED();
|
|
|
- }
|
|
|
+ // FIXME: mprotect the instruction stream as PROT_READ
|
|
|
+ // This is currently not possible because instructions can have destructors (that clean up strings)
|
|
|
+ // Instructions should instead be destructor-less and refer to strings in a string table on the Bytecode::Block.
|
|
|
+ // It also doesn't work because instructions that have String members use RefPtr internally which must be in writable memory.
|
|
|
}
|
|
|
|
|
|
void Block::dump() const
|