Permalink
Browse files

Unpack structures

  • Loading branch information...
waj committed Dec 4, 2013
1 parent fcf0254 commit 6657d3c84c93ec0c886aa9262b2a33791e22285f
Showing with 7 additions and 8 deletions.
  1. +5 −6 src/compiler/crystal/codegen/llvm_typer.cr
  2. +2 −2 src/compiler/crystal/program.cr
@@ -3,7 +3,7 @@ require "../llvm"
module Crystal
class LLVMTyper
HIERARCHY_LLVM_TYPE = LLVM.struct_type("Object+", [LLVM::Int32, LLVM.pointer_type(LLVM::Int8)], true)
HIERARCHY_LLVM_TYPE = LLVM.struct_type("Object+", [LLVM::Int32, LLVM.pointer_type(LLVM::Int8)])
HIERARCHY_LLVM_ARG_TYPE = LLVM.pointer_type(HIERARCHY_LLVM_TYPE)
getter landing_pad_type
@@ -58,16 +58,15 @@ module Crystal
max_size = size if size > max_size
end
end
max_size /= 4
max_size /= 8
max_size = 1 if max_size == 0
llvm_value_type = LLVM.array_type(LLVM::Int32, max_size)
LLVM.struct_type(type.llvm_name, [LLVM::Int32, llvm_value_type], true)
llvm_value_type = LLVM.array_type(LLVM::Int64, max_size)
LLVM.struct_type(type.llvm_name, [LLVM::Int32, llvm_value_type])
end
def create_llvm_type(type : PaddingType)
llvm_value_type = LLVM.array_type(LLVM::Int32, type.padding)
LLVM.struct_type(type.llvm_name, [LLVM::Int32, llvm_value_type], true)
LLVM.array_type(LLVM::Int32, type.padding)
end
def create_llvm_type(type : NilableType)
@@ -81,10 +81,10 @@ module Crystal
@types["Macro"] = macro_mod = NonGenericModuleType.new self, self, "Macro"
macro_var = macro_mod.types["Var"] = NonGenericClassType.new self, macro_mod, "Var", @reference
macro_var.lookup_instance_var("@padding").type = PaddingType.new(self, 17)
macro_var.lookup_instance_var("@padding").type = PaddingType.new(self, 24)
macro_ivar = macro_mod.types["InstanceVar"] = NonGenericClassType.new self, macro_mod, "InstanceVar", @reference
macro_ivar.lookup_instance_var("@padding").type = PaddingType.new(self, 17)
macro_ivar.lookup_instance_var("@padding").type = PaddingType.new(self, 24)
@symbols = Set(String).new
@global_vars = {} of String => Var

0 comments on commit 6657d3c

Please sign in to comment.