From 51ae8299d9ac9ff2961d7414e0fe1f544c9297ed Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 26 Jan 2014 03:54:50 -0800 Subject: [PATCH] Fixing stack size. --- src/alloy/backend/x64/lowering/lowering_sequences.cc | 1 + src/alloy/backend/x64/x64_code_cache.cc | 4 ++-- src/alloy/backend/x64/x64_emitter.cc | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/alloy/backend/x64/lowering/lowering_sequences.cc b/src/alloy/backend/x64/lowering/lowering_sequences.cc index 4d493663a..a7f924810 100644 --- a/src/alloy/backend/x64/lowering/lowering_sequences.cc +++ b/src/alloy/backend/x64/lowering/lowering_sequences.cc @@ -60,6 +60,7 @@ void IndirectCallThunk(void* raw_context, uint8_t* membase, uint64_t target_address) { // TODO(benvanik): generate this thunk at runtime? or a shim? auto thread_state = *((ThreadState**)raw_context); + XEASSERTALWAYS(); } void IssueCallIndirect(X64Emitter& e, Value* target, uint32_t flags) { Reg64 r; diff --git a/src/alloy/backend/x64/x64_code_cache.cc b/src/alloy/backend/x64/x64_code_cache.cc index 854e6f699..76398989b 100644 --- a/src/alloy/backend/x64/x64_code_cache.cc +++ b/src/alloy/backend/x64/x64_code_cache.cc @@ -216,7 +216,7 @@ void X64CodeChunk::AddTableEntry(uint8_t* code, size_t code_size) { // TODO(benvanik): take as parameters? bool has_prolog = false; uint8_t prolog_size = 4; - uint8_t stack_bytes = 16; + uint8_t stack_bytes = 64; // http://msdn.microsoft.com/en-us/library/ddssxxy8.aspx UNWIND_INFO* unwind_info = (UNWIND_INFO*)(buffer + unwind_info_offset); @@ -231,7 +231,7 @@ void X64CodeChunk::AddTableEntry(uint8_t* code, size_t code_size) { auto& code_0 = unwind_info->UnwindCode[0]; code_0.CodeOffset = 4; // end of instruction + 1 == offset of next instruction code_0.UnwindOp = UWOP_ALLOC_SMALL; - code_0.OpInfo = stack_bytes; + code_0.OpInfo = stack_bytes / 8 - 1; XEASSERT(stack_bytes < 128); // Add entry. diff --git a/src/alloy/backend/x64/x64_emitter.cc b/src/alloy/backend/x64/x64_emitter.cc index d72ad91b8..13c832621 100644 --- a/src/alloy/backend/x64/x64_emitter.cc +++ b/src/alloy/backend/x64/x64_emitter.cc @@ -120,7 +120,7 @@ int X64Emitter::Emit(HIRBuilder* builder) { // X64CodeCache, which dynamically generates exception information. // Adding or changing anything here must be matched! const bool emit_prolog = false; - const size_t stack_size = 16; + const size_t stack_size = 64; if (emit_prolog) { sub(rsp, stack_size); // TODO(benvanik): save registers.