Code Monkey home page Code Monkey logo

dasllvm's Introduction

dasLLVM

LLVM-C bindings for daScript

dasllvm's People

Contributors

borisbat avatar otakubeam avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

otakubeam

dasllvm's Issues

Support move for ExprMakeTuple

[E] LLVM JIT FAILED:
makeTuple: move is not supported. expr = ExprMakeTuple at %publicScripts/u2e/events.das:12:38
makeTuple: move is not supported. expr = ExprMakeTuple at %publicScripts/u2e/events.das:12:38

def AddListener(var event : IntEvent; var cb : lambda<(arg : int) : void>) : int
    event.listeners |> emplace([[auto cb, ++event.id]])
    return event.id

Add the ability to delete pointers to variants

If LLVM_JIT_ALL_FUNCTIONS is enabled we get the following error.

[E]  LLVM JIT FAILED:
delete of pointer non-structure type is not supported yet variant<shutdown:bool;add_decoder:audio_boost::AudioCommandAddDecoder;add_decoder_3d:audio_boost::AudioCommandAddDecoder3D;add_pcm:audio_boost::AudioCommandAddPCM;add_pcm_3d:audio_boost::AudioCommandAddPCM3D;add_pcm_stream:audio_boost::AudioCommandAddPCMStream;add_pcm_stream_3d:audio_boost::AudioCommandAddPCMStream3D;append_pcm:tuple<sid:uint64 aka SID;samples:array<float>>;pause:tuple<sid:uint64 aka SID;paused:bool>;volume:tuple<sid:uint64 aka SID;volume:float;time:float>;pan:tuple<sid:uint64 aka SID;pan:float>;pitch:tuple<sid:uint64 aka SID;pitch:float>;global_pitch:float;stop:tuple<sid:uint64 aka SID;time:float>;head_transform:audio_boost::AudioCommandHeadPosition3D;sound_position:audio_boost::AudioCommandSoundPosition3D;status:audio_boost::AudioCommandStatus;reverb:tuple<sid:uint64 aka SID;properties:audio::I3DL2ReverbProperties>;set_playback_position:tuple<sid:uint64 aka SID;position:uint64>;global_pause:bool> aka AudioCommand?& -const. expr = ExprDelete at %privateScripts/audio/audio_boost.das:539:12

Missing `operator -` for struct Time?

[E] LLVM JIT FAILED:
missing interop function pointer for $::-. expr = ExprOp2 at %privateScripts/audio/audio_boost.das:733:23

        if get_clock() - last_gc > 5.lf
            call_gc()

Missing function pointer in default argument call

[E] LLVM JIT FAILED:
missing function pointer for SceneNodeData. expr = ExprCall at %publicScripts/api/scene.das:50:28

struct SceneNodeData
    name : string
    parent : SceneNodeId
    position : float3 = float3(0)
    rotation : float4 = float4(0, 0, 0, 1)
    scale : float3 = float3(1)


def create_scene_node(req = SceneNodeData()) : SceneNodeId  <--------- here
    let cmd = [[CreateSceneNodeCommand resultId=get_next_scene_node(), parent=req.parent, position=req.position, rotation=req.rotation, scale=req.scale]]
    get_system_command_buffer() |> send(cmd)
    if !empty(req.name)
        cmd.resultId |> set_name(req.name)
    return cmd.resultId

Cast struct Time to int64

[E] LLVM JIT FAILED:
int64($::clock) is not supported (yet?). expr = ExprCall at %file/game_mode_events/event_database.das:100:49

    def private getCheatEvent() : EventGameModeInfo?
        // return null
        // cheat code, uncomment to enable
        var res = GetGameModeInfo(EventGameMode Size)
        var goal = _goals[1]
        goal->SetGoal(10)
        res->SetConfig(goal, "cheat reward", 0l, int64(get_clock()) + 3700l) <--------- here
        return res
        // end cheat code

Instruction does not dominate all uses!

def GenericStorage(str : string) : GenericStorage
    var res : GenericStorage
    if empty(str)
        return <- res
    var inscope bytes : array<uint8>
    base64_decode(str, bytes)
    unsafe
        var stream = ArrayStream(bytes)
        var tstream = [[StreamHolder reading=true, stream=unsafe(addr(stream))]]
        tstream |> serialize_request(res)
        if tstream.stream->logErrors("GenericStorage")
            res |> clear()
    return <- res
Instruction does not dominate all uses!
  %5 = call ptr @"@generic_storage::builtin`_return_with_lockcheck =XY<valT>S<generic_storage::GenericStorage> implementation"(ptr %variable_res, ptr %1)
  call void @llvm.memcpy.p0.p0.i32(ptr align 8 %2, ptr align 8 %5, i32 48, i1 false)

В этой функции %5 и %12 определяются только в true ветке if-а, а затем используются в memcpy

define dllexport void @"@generic_storage::GenericStorage Cs implementation"(ptr readonly %0, ptr noalias nocapture align 16 %1, ptr noalias nocapture align 8 %2) {
entry:
  %call_block = alloca ptr, align 8
  store ptr null, ptr %call_block, align 8
  %"variable_bytes`at`273`16" = alloca { ptr, i32, i32, i32, i32 }, align 16
  %variable_res = alloca [48 x i8], align 16
  %variable_stream = alloca [104 x i8], align 16
  %variable_tstream = alloca [16 x i8], align 16
  %args = alloca [2 x <4 x float>], align 16
  br label %body_0x7fefe5a7fdb0

body_0x7fefe5a7fdb0:                              ; preds = %entry
  call void @llvm.memset.p0.i32(ptr align 8 %"variable_bytes`at`273`16", i8 0, i32 24, i1 false)
  call void @llvm.memset.p0.i32(ptr align 8 %variable_res, i8 0, i32 48, i1 false)
  br label %if_cond_at_271_

finally_block_at_270_:                            ; preds = %if_end_at_line_279_, %if_true_at_line_271_
  call void @"@generic_storage::builtin`finalize X1<Y<TT>u8>A implementation"(ptr %"variable_bytes`at`273`16", ptr %1)
  %3 = load ptr, ptr %call_block, align 8
  indirectbr ptr %3, [label %return_after_call_finally_block_270_, label %return_after_call_finally_block_270_5]

if_cond_at_271_:                                  ; preds = %body_0x7fefe5a7fdb0
  %4 = call i1 @"@$::empty CIs"(ptr %0)
  br i1 %4, label %if_true_at_line_271_, label %if_false_at_line_271_

if_true_at_line_271_:                             ; preds = %if_cond_at_271_
  %5 = call ptr @"@generic_storage::builtin`_return_with_lockcheck =XY<valT>S<generic_storage::GenericStorage> implementation"(ptr %variable_res, ptr %1)
  store ptr blockaddress(@"@generic_storage::GenericStorage Cs implementation", %return_after_call_finally_block_270_), ptr %call_block, align 8
  br label %finally_block_at_270_

if_false_at_line_271_:                            ; preds = %if_cond_at_271_
  %6 = load ptr, ptr @227, align 8
  %7 = call i32 @"@public_base64::base64_decode CIs I1<u8>A C_c C_l"(ptr %0, ptr %"variable_bytes`at`273`16", ptr %1, ptr %6)
  call void @"@array_stream::ArrayStream 1<u8>A implementation"(ptr %"variable_bytes`at`273`16", ptr %1, ptr %variable_stream)
  %8 = getelementptr inbounds i8, ptr %variable_tstream, i32 0
  %"[0].reading" = getelementptr inbounds i8, ptr %variable_tstream, i32 0
  store i1 true, ptr %"[0].reading", align 1
  %9 = getelementptr inbounds i8, ptr %variable_tstream, i32 8
  %"[0].stream" = getelementptr inbounds i8, ptr %variable_tstream, i32 8
  store ptr %variable_stream, ptr %"[0].stream", align 8
  call void @"@generic_storage::serialize_request S<base_serializer::StreamHolder> S<generic_storage::GenericStorage> implementation"(ptr %variable_tstream, ptr %variable_res, ptr %1)
  br label %if_cond_at_279_

if_end_at_line_271_:                              ; No predecessors!
  unreachable

return_after_call_finally_block_270_:             ; preds = %finally_block_at_270_
  call void @llvm.memcpy.p0.p0.i32(ptr align 8 %2, ptr align 8 %5, i32 48, i1 false)
  ret void

if_cond_at_279_:                                  ; preds = %if_false_at_line_271_
  %10 = getelementptr inbounds i8, ptr %variable_tstream, i32 8
  %11 = load ptr, ptr %10, align 8
  br label %check_null_ptr

if_true_at_line_279_:                             ; preds = %check_end3
  call void @"@generic_storage::clear S<generic_storage::GenericStorage> implementation"(ptr %variable_res, ptr %1)
  br label %if_end_at_line_279_

if_false_at_line_279_:                            ; preds = %check_end3
  br label %if_end_at_line_279_

if_end_at_line_279_:                              ; preds = %if_false_at_line_279_, %if_true_at_line_279_
  %12 = call ptr @"@generic_storage::builtin`_return_with_lockcheck =XY<valT>S<generic_storage::GenericStorage> implementation"(ptr %variable_res, ptr %1)
  store ptr blockaddress(@"@generic_storage::GenericStorage Cs implementation", %return_after_call_finally_block_270_5), ptr %call_block, align 8
  br label %finally_block_at_270_

check_null_ptr:                                   ; preds = %if_cond_at_279_
  %null_check = icmp eq ptr %11, null
  br i1 %null_check, label %check_true, label %check_end

check_true:                                       ; preds = %check_null_ptr
  %13 = load ptr, ptr @229, align 8
  call void @jit_exception(ptr @26, ptr %1, ptr %13)
  br label %check_end

check_end:                                        ; preds = %check_true, %check_null_ptr
  %14 = getelementptr inbounds i8, ptr %11, i32 80
  %15 = load { ptr }, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr %variable_tstream, i32 8
  %17 = load ptr, ptr %16, align 8
  br label %check_null_ptr1

check_null_ptr1:                                  ; preds = %check_end
  %null_check4 = icmp eq ptr %17, null
  br i1 %null_check4, label %check_true2, label %check_end3

check_true2:                                      ; preds = %check_null_ptr1
  %18 = load ptr, ptr @231, align 8
  call void @jit_exception(ptr @26, ptr %1, ptr %18)
  br label %check_end3

check_end3:                                       ; preds = %check_true2, %check_null_ptr1
  %call_arg_0_ptr = getelementptr inbounds <4 x float>, ptr %args, i32 0
  store ptr %17, ptr %call_arg_0_ptr, align 8
  %call_arg_1_ptr = getelementptr inbounds <4 x float>, ptr %args, i32 1
  store ptr @225, ptr %call_arg_1_ptr, align 8
  %SIMFUNCTION = extractvalue { ptr } %15, 0
  %invoke = call <4 x float> @jit_call_or_fastcall(ptr %SIMFUNCTION, ptr %args, ptr %1)
  %19 = extractelement <4 x float> %invoke, i32 0
  %20 = bitcast float %19 to i32
  %vec4f_to_bool = trunc i32 %20 to i1
  br i1 %vec4f_to_bool, label %if_true_at_line_279_, label %if_false_at_line_279_

return_after_call_finally_block_270_5:            ; preds = %finally_block_at_270_
  call void @llvm.memcpy.p0.p0.i32(ptr align 8 %2, ptr align 8 %12, i32 48, i1 false)
  ret void
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.